I have the following directory structure
foo/
__init__.py
settings.py
bar/
__init__.py
myfile.py
In myfile.py I have: import settings
I get the following error: ImportError: No module named settings
, why? How can I efectively import the settings
file from myfile.py
Here is another method that seems more clear:
In
foo.__init__.py
:In
myfile.py
:From http://docs.python.org/2/tutorial/modules.html#intra-package-references :
Hope it helps