I have two python classes, one uses the other's variable
class A:
class A(object):
variable = None
@classmethod
def init_variable(cls):
cls.variable = something
class B:
variable = __import__('module').A.variable
class B(object):
@staticmethod
def method():
return variable
I simplified my problem as much as possible. So my question is why I still have B.method() returning NoneType even if I update A.variable class variable with something using init_variable
Alike this you create a new instance of that module instead of importing the already existing module. Also, when do you updateA.variable?A.variableneed user input so I wantBclass to work with this variable when it's updated