ModuleNotFoundError: No module named when importing from the sub directory

  python, python-3.8

Good day everyone. I have search every stackoverflow but still nothing works for me.

I have following structure:

vision
|_____ main.py
|_____ Classes
      |_________ Rocket.py
      |_________ __init__.py   which is empty

Now I want to use class rocket which is in Rocket.py in main.py

I have tried

import Classes.Rocket

import .Rocket

import Rocket

In all cases it raises the ModuleNotFoundError:

Nothing works. Any suggestion?

Source: Python Questions

LEAVE A COMMENT