Its possibly a very silly question and I just do not know how to look for this solution or what to search.
What I was trying is
class X:
def __init__(self, myvariable):
self.myvariable = myvariable
def printVar(self):
print(self.myvariable)
class Z:
aa = 'test'
class Y(Z):
#xx = X(self.aa)
def __init__(self):
self.xx = X(self.aa)
x = Y()
x.xx.printVar()
it works as expected. I was wondering whether its possible to use as
class Y(Z):
xx = X(self.aa)
selfis not defined in the class scope.