application
├── app
│ └── folder
│ └── file_1.py
│ └── file_2.py
└── app2
└── folder2
└── file_3.py
I created a file_3 and trying to use classes found in file_1.
I tried to import using the following method but had an issue because file_1 is importing file_2 and was raising an error.
import sys
sys.path.append('/.../application/app/folder')
import file_1
How could I import file_1 from file_3 and all the files file_1 is importing.
CodePudding user response:
I think the answer you are looking for is explained in this article. If I further understand you correctly, file_1
is using classes from file_2
? So my guess would be, that you also have to import file_2
aswell because the current working directory does not contain a file named file_2
.
CodePudding user response:
Go to folder2 and do this
from app.folder.file_1 import classeName