0

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!

soulynn
  • 89
  • 1
  • 3
  • 13

1 Answers1

0

It is good to edit python include path.

import os, sys
sys.path.append(f"{os.path.dirname(__file__)}/models")

from models import *
tomo_iris427
  • 161
  • 6