ModuleNotFoundError even though the Module is present

I am getting a ModuleNotFoundError for a module that exists. I have a and imported sys but I am still getting a ModuleNotFoundError error on my django error.

My file structure:


I want to import a function from in This is my code:

import sys
from folder2.test import func1, func2

#my code

When I run this, I am getting this error: ModuleNotFoundError: No module named 'folder2.test'

How can I fix this error?


Above link might help you.

test is in folder1, so folder2.test will look for folder1\folder2\, which is why the error comes up. Try changing the import to ..folder2.test.

Back to Top