class A:
def __init__(self, cash):
self.msg = "I am A"
self.cash = cash
def __iama(self):
print(f"{self.msg} and have ${self.cash}")
class B:
def __init__(self):
self.A = A(5)
def show(self):
self.A.__iama()
if __name__ == '__main__':
B().show()
Traceback (most recent call last):
File "/home/fmadmin/workspace/test_automation/src/./example.py", line 19, in <module>
B().show()
File "/home/fmadmin/workspace/test_automation/src/./example.py", line 16, in show
self.A.__iama()
^^^^^^^^^^^^^
AttributeError: 'A' object has no attribute '_B__iama'. Did you mean: '_A__iama'?