Does the models folder has an __init__.py file inside it ? Only then, it will be recognized as a module by python and import models would make sense. So, Create an empty __init__.py file in the models subfolder and then the code should work without any issues. You should also look at this answer.
ModuleNotFoundError: No module named 'requests.adapters'; 'requests' is not a package It turns out the file I created in the same folder named "requests.py" made a conflict.
Why do I get a "ModuleNotFoundError" in VS Code despite the fact that I already installed the module? Asked 6 years, 5 months ago Modified 6 days ago Viewed 444k times
ModuleNotFoundError: No module named 'distutils.msvccompiler' when trying to install numpy 1.16 Asked 1 year, 2 months ago Modified 11 months ago Viewed 22k times
Traceback (most recent call last): File "mountain.py", line 28, in ? from toolkit.interface import interface ImportError: No module named toolkit.interface I have already checked sys.path and there I have the directory /site-packages. Also, I have the file __init__.py.bin in the toolkit folder to indicate to Python that this is a package. I also have a __init__.py.bin in the examples directory ...
ModuleNotFoundError: No module named 'module1' But the import works fine if I execute the script outside a notebook: if I create test.py in the same directory and do the same as in the notebook the import would work properly.