0

I have a small issue regarding importing a class from another python file.

Here is the file that I try to import. The EvaluationDetect is a class from the evaluation_detect.py file. The file evaluation_detect.py is located into path

from oculus_evaluation.oculus_evaluation.evaluation_detect import EvaluationDetect

And Pycharm IDE always shows me this error message.

ModuleNotFoundError: No module named 'oculus_evaluation.oculus_evaluation'; 'oculus_evaluation' is not a package

Please I do not understand where is the wrong in this case. There is not possible to import a class. This a legacy code and I do not understand.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Renos Bardhis
  • 325
  • 2
  • 5
  • 11
  • Did you try any of the MANY questions here on SO on the subject? To name just a few: https://stackoverflow.com/questions/61532337/python-modulenotfounderror-no-module-named ; https://stackoverflow.com/questions/43728431/relative-imports-modulenotfounderror-no-module-named-x ; https://stackoverflow.com/questions/54598292/python-modulenotfounderror-when-trying-to-import-module-from-imported-package/54613085 – Tomerikoo Nov 05 '20 at 15:10
  • Do you really want `oculus_evaluation` in your module spec twice? – CryptoFool Nov 05 '20 at 15:20
  • I saw some good results by writing ```import sys from os.path import dirname, abspath d = dirname(dirname(abspath(__file__))) sys.path.append(d)``` on **__init__.py** – Renos Bardhis Nov 06 '20 at 11:37

0 Answers0