Last Updated: February 25, 2016
·
688
· kirang89

Relative imports in Python

In case you want to do a relative import in Python, first add the path to sys.path like this:

import sys
sys.path.append('<your path>')

You can now import any module from that path directly

Note: Relative import is not recommended as per PEP8 standards