Skip to content Skip to sidebar Skip to footer

Import From Another Directory

I need to import .py file from another one in another directory (import app2 from app1) So there is directory tree app: dir1: app1.py dir2: app2.py My prob

Solution 1:

Add your additional directories to the system path

import sys
sys.path.insert(0, "/path/to/app1/dir2")
sys.path.insert(0, "/path/to/app2/dir2")

Post a Comment for "Import From Another Directory"