Important read: The Cost of Small Modules
-
The
import __init__statement should only be inside theifmain-Test()part of the code -
Once imported the
__init__file should work for all folders, that is, it should set up rules for the import system to follow in the more general way possible, like:- All files and folders in from the root folder down should be loaded in the
sys.modulesas Lazy_pyFolder(the folders) and Lazy_pyFile - The
builtins.__import__function has to be re-written to allow smart relative imports.
- All files and folders in from the root folder down should be loaded in the
Have to decide if a Lazy_pyFile once called changes type to a function or not
- Also have to decide if i want the Lazy_pyFile class or prefer to modify again how the
builtins.__import__works to allow the automatic switch once the module it’s imported
This one looks good
modify the builtins.__import__ such that if the module to be imported is a Lazy_pyFile import it as a function or a module
- Function if it has a callable with the same name
- Module if it does not
Solution
![[init.py code (2022 - 12 - 16)]]