I have a Python module that I want to dynamically import given only a string of the module name. Normally I use importlib
or __import__
and this works quite well given that I know which objects I want to import from the module, but is there a way to do the equivalent of import *
dynamically. Or is there a better approach?
I know in general its bad practice to use import *
but the modules I'm trying to import are automatically generated on the fly and I have no way of knowing the exact module which contains the class I'm addressing.
Thanks.