How to import .py file from another directory?

The Solution to How to import .py file from another directory? is


You can add to the system-path at runtime:

import sys
sys.path.insert(0, 'path/to/your/py_file')

import py_file

This is by far the easiest way to do it.

~ Answered on 2014-04-09 07:47:37


Most Viewed Questions: