I'm getting the following error for my code:
TypeError: A_class_meth() missing 1 required positional argument: 'A_class_meth_var1'.
What should be modify in "A.A_class_meth"?
class A():
def __init__(self,init_var):
self.init_var = init_var
def A_class_meth(self, A_class_meth_var1):
print("run")
class B():
def Start(self):
self.B_class_var = A("NAME")
A.A_class_meth(self.B_class_var)
var = B()
var.Start()
Create and store an instance of your A class inside the
start()method and then reference that.Otherwise, the
self.B_class_varis getting passed as theselfparameteror else, alternatively, as suggested above, make the
A_class_metha static method and remove theselfparameter: