Use the getattr built-in function. See the documentation
obj = MyClass()
try:
func = getattr(obj, "dostuff")
func()
except AttributeError:
print("dostuff not found")
Use the getattr built-in function. See the documentation
obj = MyClass()
try:
func = getattr(obj, "dostuff")
func()
except AttributeError:
print("dostuff not found")