When using PHP, I write code in a separate file that I include using require_once()
or include_once()
. Is there something similar in Python as well?
I read this answer: Is there an alternative python function does as PHP include() function?
The file I want to run in run.py
. The file I want to include is funcs.py
. The funcs.py
file is located inside a folder called includes
. The folder includes
and run.py
are in the same location.
I created an empty file __init__.py
.
I use from includes import funcs
. However, I get the error No Module named includes
.
What am I doing wrong?