How can you execute a method by giving its name, from another method that is in the same class with the called method? Like this:
class Class1:
def __init__(self):
pass
def func1(self, arg1):
# some code
def func2(self):
function = getattr(sys.modules[__name__], "func1") # apparently this does not work
Any suggestion?
how about
getattr(self, "func1")? Also, avoid using the name functionFor example: