call string as function python code example
Example 1: python execute function from string
import foo
method_to_call = getattr(foo, 'bar')
result = method_to_call()
Example 2: python call function by string
getattr(obj, 'func')('foo', 'bar', 'args')
Example 3: python get function from string name
module = __import__('foo')
func = getattr(module, 'bar')
func()