print(my_function.__name__) # "my_function"
module = __import__('foo') func = getattr(module, 'bar') func()