Assume I have this barebones structure:
project/ main.py providers/ __init.py__ acme1.py acme2.py acme3.py acme4.py acme5.py acme6.py
Assume that main.py contains (partial):
if complexcondition(): print providers.acme5.get()
Where __init__.py is empty and acme*.py contain (partial):
def get(): value=complexcalculation() return value
How do I change these files to work?
Note: If the answer is ‘import acme1’, ‘import acme2’, and so on in __init__.py, is there a way to accomplish that without listing them all by hand?
This question asked today, Dynamic Loading of Python Modules, should have your answer.