Python imports: demystified

* the most confusing part of Python i think (it’s too simple, that’s why)
Good discussion here: http://stackoverflow.com/questions/72852/how-to-do-relative-imports-in-python
Python imports use the environment variable $PYTHONPATH to search for packages.
Here is what I currently have in my .bashrc file:
export PYTHONPATH=.:/usr/bin/python2.7:/work/bcom/stats-processing
Relative imports do not work as they should for now.
Therefore, people usually create a file in the root folder, which imports everything needed.

Leave a comment