I have a python file that is beginning to have a lot of import statements like
from enum import auto
Let's say I have a file called a.py and a.py uses from enum import auto
.
Is there a way that I can create a separate file called imports.py
that imports all the modules that I specify using importlib?
I have tried the following with no success:
modules.append(importlib.import_module(auto, Package=enum))
(modules is an array that will hold the imported modules)
The error says
Traceback (most recent call last):
File ".import.py", line 17, in <module>
modules.append(importlib.import_module(auto,Package=enum))