3 ms·
E.g. I have file aaa.py, bbb.py and ccc.py (placed in the same directory but I don't mind adding a line of code to declare their relationship explicitly). What
by qwerty456127 9y ago
E.g. I have file aaa.py, bbb.py and ccc.py (placed in the same directory but I don't mind adding a line of code to declare their relationship explicitly). What I want is not only to be able to import them all at once in ddd.py but to access everything from aaa and bbb in ccc, everything from bbb and ccc in aaa and everything from aaa and ccc in bbb [almost] seamlessly.
- iguessthislldo 9y agoYou could create a __init__.py file that imports everything from each of those files: from .aaa import * from .bbb import * from .ccc import * Then in each of the other files (aaa.py, etc) put: from . import *
- true_religion 9y agoThats a circular import and thus not guaranteed to work.
- deleted 9y ago[deleted]