To get the module, you can use globals
. To get the function, use getattr
:
getattr(globals()[module_name], function_name)
Importing a module just binds the module object to a name in whatever namespace you import it in. In the usual case where you import at the top level of the module…
Top comments (0)