Directory issue: Module not Found

30 Views Asked by At

I'm trying to import two modules in a main.py file. The file structure is like this

|Common-Folder
|
|
|__Folder
|  |___main.py
|
|
|__Tools(folder)
| |___models
| |___maze

inside main, I do

import sys import os

module_dir = os.path.join('/content/drive/MyDrive/.../Common-folder/Tools')

if module_dir not in sys.path:
    sys.path.append(module_dir)

import models import maze

This still results in ModuleNotFound Error, like this:

Traceback (most recent call last):
  File "/content/drive/MyDrive/.../main.py", line 64, in <module>
    import models
ModuleNotFoundError: No module named 'models'
0

There are 0 best solutions below