For better code readability, let's suppose that I've got my code logically splitted in different python files, my main main.py
file and an included.py
file. I'd like to embed included.py
inside of the main file.
I know it's possible to import
it on main.py
(e.g. from included import *
), but, in some cases, objects/classes/variables on the main.py
file may be imported on the included.py
file too (e.g. from main import *
).
What I'd like to do is to import the included.py
file "as is" (like PHP does, with the include
statement) on a specific position of my main.py
file, by forcing the interpreter to read the content of the file and to place it on the specified position.
Is it possible?