My main script reads another script that lies in a sub-folder "models". Codes had been working perfectly until recent tech refresh/whole machine updates. Error reads: Module not found . Error also happens when I try to import a library which ran perfectly previously. No issue with importing other libraries like tensorflow & keras though. Suspect issues with calling path directory but not sure how to approach and resolve.
from models.model import *
import pdf2image
The project structure is as follows. I will run mainscript.py for this project.
/project/mainscript.py
/project/models/model.py
Any guidance is much appreciated!
It is good to edit python include path.
import os, sys
sys.path.append(f"{os.path.dirname(__file__)}/models")
from models import *
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.