class MyClass:
def __init__(self, i):
self.i = i
def get(self):
func_name = 'function' + self.i
self.func_name() # <-- this does NOT work.
def function1(self):
pass # do something
def function2(self):
pass # do something
This gives the error: TypeError: 'str' object is not callable
How would I go about doing this?
Note: self.func_name
also does not work