Answers for "import modules given the full path python"

0

import modules given the full path python

# quick and easy way if you have a bunch of files in a directory

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
Posted by: Guest on March-15-2022

Python Answers by Framework

Browse Popular Code Answers by Language