I am trying to access variable X. Here is my code:
class A:
def A(self):
self.DD = "aaaaaaaaaaaaaaaa"
class B(A):
def __init__(self):
Scenario.__init__(self)
def A(self):
self.x = self.DD
print(self.x)
if __name__ == '__main__':
B = B()
B.A()
I am getting error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-23-89f50bf48427> in <module>
14 if __name__ == '__main__':
15 B = B()
---> 16 B.A()
<ipython-input-22-d2fecfd66f95> in A(self)
15 def A(self):
16 self.xx = self.Business_Org
---> 17 self.x = self.DD
18 print(self.x)
19
AttributeError: 'B' object has no attribute 'DD'
I found a similar question here: Accessing variable outside class using Inheritence. But not answer properly. If anyone can help me it will be really appreciatable.