Skip to content Skip to sidebar Skip to footer

Python3 Importing Module/package From Sibling Directories

Here is my code directory structure: /root -/proj1 --/module1.py --/__init__.py --/sub_proj1 ---/module2.py ---/__init__.py -/proj2 --/module3.py If I want to import code from mod

Solution 1:

Similar to this question:

Python import module from sibling folder

You need an __init__.py in your root and both project folders

Also this should be your import statement:

from ..proj1.sub_proj1import *

Post a Comment for "Python3 Importing Module/package From Sibling Directories"