Approach 3: Synbol Tables
Built-in function locals() and globals() return a dictionary of current local and global symbol table respectively. So you could call a function just like:
def my_func(arg1, arg2):
return arg1 + arg2
r = locals()['my_func'](http://1, 2)
The output is:
This approach is just like the examples provided in the very beginning of this post, in which, I maintained a symbol table by myself and called the function by its string-typed name.