Import a module not in path

Post date: Feb 2, 2015 7:12:54 PM

The easiest way is to append the full path using sys.path.append:

import sys # the mock-0.3.1 dir contains testcase.py, testutils.py & mock.py sys.path.append('/foo/bar/mock-0.3.1')  from testcase import TestCase from testutils import RunTests from mock import Mock, sentinel, patch

from

http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path