Lets say I have a function bar inside a module called foo.py . Somewhere inside foo.py, I want to be able to call bar() from the string \"bar\". Ho
bar
foo.py
Use a dictionary that keeps the mapping of functions you want to call:
if __name__ == '__main__': funcnames = {'bar': bar} funcnames['bar']()