I am trying to refactor my code (a bunch of core modules and some apps living in a common directory).
I want to get this structure
Root
__init__.py
Core
__init__.py
a.py
b.py
c.py
AppOne
__init__.py
AppOne.py
AppTwo
__init__.py
AppTwo.py
AppThree
__init__.py
AppThree.py
where AppOne.py, AppTwo.py and AppThree.py imports the modules a, b and c in the Core package.
I don’t understand how to write the __init__.py files and the import statements. I have read
http://docs.python.org/tutorial/modules.html and http://guide.python-distribute.org/creation.html. I got errors like “Attempted relative import in non-package” or “Invalid Sintaxis”
You need to add the directory of the python modules to sys path.
If you have something like this
You need to add you module directory to sys_path