My folders hierarchy looks like this
├───folder1
│ ├───pythonFile1.py
│ └───pythonFile2.py
├───app.py
and i'm trying to import python file from another folder like this
(the import is from pythonFile2 to app.py)
from folder1 import pythonFile2
but i get this error ➡ ModuleNotFoundError: No module named 'pythonFile1'
Can you tell me how to import python file from another folder?
Thank you !!
I think the problem is in the file path you want to import, either you put the correct relative or absolute path and it works fine look at the example on the picture
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.