I want to call class member function through object .The function is mapped in dictionary to a string. I will actually refer the string(key) to call the function(value). It is giving me error that 1 positional argument is required even when I pass the argument. Why do I have to pass the obj name?
When I pass the object instance as 1st parameter, it works.
class A():
def foo(self , arg):
print(arg)
dict = {"foo" :foo}
outside class :
obj = A()
obj.dict["foo"](10) #not working
#------------------------
obj.dict["foo"](obj,10) #working