All modules in Python have to have a certain directory structure. You can find details here.

Create an empty file called __init__.py under the model directory, such that your directory structure would look something like that:

.
└── project
    └── src
        ├── hello-world.py
        └── model
            ├── __init__.py
            └── order.py

Also in your hello-world.py file change the import statement to the following:

from model.order import SellOrder

That should fix it

P.S.: If you are placing your model directory in some other location (not in the same directory branch), you will have to modify the python path using sys.path.

Answer from RafazZ on Stack Overflow
🌐
freeCodeCamp
freecodecamp.org › news › module-not-found-error-in-python-solved
ModuleNotFoundError: no module named Python Error [Fixed]
September 12, 2022 - Sometimes, Python throws the ModuleNotFoundError afterward. What does this error mean in Python? As the name implies, this error occurs when you're trying to access or use a module that cannot be found.
Discussions

Python error "ImportError: No module named" - Stack Overflow
Although you have installed the libraries you need in Python, but in your custom project 'venv', it is not available. This is the real reason of 'ImportError: No module named xxxxxx' occurred in PyCharm. To resolve this issue, you must add libraries to your project custom env by these steps: ... Then, all you needed package will be installed in you project custom 'venv' folder. ... Fixed my issue by writing print (sys.path) and found ... More on stackoverflow.com
🌐 stackoverflow.com
Why do I get a ModuleNotFoundError?
You probably have a circular dependency - abc imports xyz and xyz imports abc. Python can't complete either import so it raises an error. More on reddit.com
🌐 r/learnpython
4
1
September 2, 2021
"No module named X found"
Don't install with pip install. You will not know, which python version's pip is being used for the install. And you will not know which python installation, the packages will be installed in. If you are in an activated virtual enviroment and are going to install there (which is almost always what you should want to): python -m pip install name-of-package If for some odd reason you want to install directly in your main python install, specify which python, so it doesn't end up in the wrong one: Windows: py -3.11 -m pip install name-of-package Linux and others: python3.11 -m pip install name-of-package Do not overwrite paths. When you are doing that, you are trying to fix something, which wasn't broken. More on reddit.com
🌐 r/learnpython
6
0
March 11, 2024
ModuleNotFoundError: No module named
Sorry I "learned" Python in highschool and trying to properly learn it in College so my terminology maybe wrong ... Sorry I was trying to post according to guidelines! If I need to clarify lmk. ... You have to install it first. I get the same error. I'm lost "no module named...", how importing works? ... I build Lsposed useful module! ... Installed MSS (screenshot module) but can't use it. VS Code tells me "module not found... More on reddit.com
🌐 r/learnpython
7
3
March 6, 2018
🌐
OneUptime
oneuptime.com › home › blog › how to fix 'modulenotfounderror' in python
How to Fix 'ModuleNotFoundError' in Python
January 24, 2026 - When you write import something, Python searches for the module in this order: ... If your module is not in any of these locations, you get ModuleNotFoundError. The most frequent cause is simply that the package is not installed: # This fails ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › modulenotfounderror-no-module-named-error-in-python
ModuleNotFoundError: No module named Error in Python - GeeksforGeeks
July 23, 2025 - The "No Module Named..." error is raised when Python attempts to import a module that it cannot locate. Modules are essentially Python files containing functions and variables that can be reused in different parts of a program.
🌐
PyTutorial
pytutorial.com › how-to-solve-modulenotfounderror-no-module-named-in-python
How To Solve ModuleNotFoundError: No module named in Python …
August 11, 2026 - Sometimes, the module exists, but Python cannot find it. This happens when the module is not in Python's search path. The path is a list of directories Python checks for modules. You can view the current path using the sys module.
🌐
Medium
medium.com › @ryan_forrester_ › fixing-no-module-named-errors-in-python-a-complete-guide-b989b7a2bd19
Fixing ‘No Module Named’ Errors in Python: A Complete Guide | by ryan | Medium
May 14, 2025 - # At the start of your notebook import sys import os # Add parent directory to path module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) # Now you can import from parent directory from my_package import my_function ... # Create virtual environment python -m venv venv # Activate it # On Windows: .\venv\Scripts\activate # On Unix/Mac: source venv/bin/activate # Install packages pip install -r requirements.txt # Generate requirements file pip freeze > requirements.txt
🌐
Towards Data Science
towardsdatascience.com › home › programming › how to fix modulenotfounderror and importerror
How to Fix ModuleNotFoundError and ImportError | Towards Data Science
September 13, 2020 - Now we're up to speed with how the basic import statement is executed and what is the difference between absolute and relative imports we can now go ahead and discuss what to do when your Python application fails with either ModuleNotFoundError ** or** ImportError . In most of the cases, either of the errors occur due to the fact that Python is unable to resolve the module's name in sys.path . Recall that when you call import a if the module's name was found neither in sys.modules nor in standard library, Python will try to resolve it in sys.path .
Find elsewhere
🌐
OneUptime
oneuptime.com › home › blog › how to fix 'importerror: no module named' in python
How to Fix 'ImportError: No module named' in Python
January 26, 2026 - # debug_imports.py # Diagnose import issues import sys import importlib.util def debug_import(module_name): """Debug why a module cannot be imported.""" print(f"\n=== Debugging import: {module_name} ===\n") # Check if already imported if module_name in sys.modules: print(f"Module '{module_name}' is already imported") print(f"Location: {getattr(sys.modules[module_name], '__file__', 'built-in or namespace module')}") return # Try to find the module spec = importlib.util.find_spec(module_name) if spec is None: print(f"Module '{module_name}' NOT FOUND") print("\nPossible causes:") print(f" 1. Module is not installed (pip install {module_name})") print(" 2. You are using the wrong Python environment") print(" 3.
🌐
eSparkBiz
esparkinfo.com › module not found – "no module named" in python
Python ImportError: No Module Named - Fix Explained
June 5, 2026 - If you’ve manipulated PYTHONPATH, or you’re running code from an unexpected directory, Python may not locate the module. ... If you’re working with packages or running scripts from outside the project root, try using python -m module_name instead of directly calling the script.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-the-module-not-found-error
How to Fix The Module Not Found Error - Python
July 1, 2026 - Explanation: correct package name is pandas, but pands was used. Since no module with that name exists, Python raises an error.
🌐
iO Flood
ioflood.com › blog › python-no-module-named
[SOLVED] 'No Module Named' Python Error Solutions
January 30, 2024 - The ‘No Module Named’ error in Python occurs when Python cannot find a module you’re trying to import. The first steps to resolve this are to check if the module is installed and if it’s in the Python PATH. Here’s a simple example of how to check: import sys print(sys.path) # Output: # ['...', '...'] In this example, we import the sys module and print the Python PATH. If the module’s path is not in the output, you may need to add it.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-fix-the-module-not-found-error
How to Fix The Module Not Found Error? - GeeksforGeeks
April 28, 2025 - Whenever you encounter "ModuleNotFoundError" can check if the imported modules are installed in your Python environment by using 'try' and 'except' blocks to handle the error gracefully.
🌐
CodeWithHarry
codewithharry.com › blogpost › solved-modulenotfounderror-no-module-named-in-python
[Solved] ModuleNotFoundError: no module named ' ' in Python | Blog | CodeWithHarry
The error message 'ModuleNotFoundError: No module named x' typically occurs when you try to import a module or package named 'x' that Python cannot find in its search paths. In easy words – Python is unable to locate the module you're trying to use. Incorrect Module Name: The most straightforward ...
🌐
Medium
alinawrites.medium.com › how-to-fix-modulenotfounderror-no-module-named-error-in-python-2d66875df96
How to Fix ModuleNotFoundError (No Module Named) Error in Python | by Alina Writes | Medium
August 3, 2022 - To fix this, make sure you’re using the correct module name, and that the module is in your Python path. Another common cause of this error is a circular dependency. That is, two modules that are trying to import each other. This will cause an infinite loop, and eventually raise the “ModuleNotFoundError: No module named” error. To fix this, make sure that there are no circular dependencies in your code. Finally, make sure that all modules are imported in the correct order.
🌐
Containersolutions
containersolutions.github.io › runbooks › posts › python › module-not-found
Module Not Found – Runbooks
Traceback (most recent call last): File "afile.py", line 1, in <module> import doesnotexist ImportError: No module named doesnotexist · When you run a Python application, script, or interactive terminal, you see an error that looks like the above.
Top answer
1 of 16
327

Based on your comments to orip's answer, I guess this is what happened:

  1. You edited __init__.py on Windows.
  2. The Windows editor added something nonprinting, perhaps a carriage-return (end-of-line in Windows is CR/LF; in Unix it is LF only), or perhaps a Ctrl + Z (windows end-of-file).
  3. You used WinSCP to copy the file to your Unix box.
  4. WinSCP thought: "This has something that's not basic text; I'll put a .bin extension to indicate binary data."
  5. The missing __init__.py file (now called __init__.py.bin) means Python doesn't understand toolkit as a package.
  6. You create the __init__.py file in the appropriate directory and everything works...?
2 of 16
116

I ran into something very similar when I did this exercise in LPTHW; I could never get Python to recognise that I had files in the directory I was calling from. But I was able to get it to work in the end. What I did, and what I recommend, is to try this:

(NOTE: From your initial post, I am assuming you are using an *NIX-based machine and are running things from the command line, so this advice is tailored to that. Since I run Ubuntu, this is what I did)

  1. Change directory (cd) to the directory above the directory where your files are. In this case, you're trying to run the mountain.py file, and trying to call the toolkit.interface.py module, which are in separate directories. In this case, you would go to the directory that contains paths to both those files (or in other words, the closest directory that the paths of both those files share). Which in this case is the toolkit directory.

  2. When you are in the toolkit directory, enter this line of code on your command line:

    export PYTHONPATH=.

    This sets your PYTHONPATH to ".", which basically means that your PYTHONPATH will now look for any called files within the directory you are currently in, (and more to the point, in the sub-directory branches of the directory you are in. So it doesn't just look in your current directory, but in all the directories that are in your current directory).

  3. After you've set your PYTHONPATH in the step above, run your module from your current directory (the toolkit directory). Python should now find and load the modules you specified.

🌐
Reddit
reddit.com › r/learnpython › why do i get a modulenotfounderror?
r/learnpython on Reddit: Why do I get a ModuleNotFoundError?
September 2, 2021 -

Hey Guys,

I get a weird ModuleNotFoundError in one of my projects and i do not really understand why. So here is my Folder Structure:

Project\

| main.py

| packageabc\

| | __init__.py

| | abc.py

| | packagexyz\

| | | xyz.py

In every .py file is an abc/xyz or main class. Now the interesting part. Inside the abc.py I do an import like this:

from packagexyz.xyz import xyz

This works perfectly fine!

Inside the main.py I do an import like this:

from packageabc.abcimport abc

Now I get an ModuleNotFoundError. Error Code looks like this:

from packagexyz.xyz import xyz ModuleNotFoundError: no module named packagexyz.

So the import in the abc.py File that works perfectly when tested inside the file does not work if the abc.py file is imported. So why is that?

Top answer
1 of 2
2
You probably have a circular dependency - abc imports xyz and xyz imports abc. Python can't complete either import so it raises an error.
2 of 2
1
It's because of the way Python looks for modules. There's a list of paths that Python looks through to find modules, which automatically includes things like the place pip installs packages to. It also automatically includes the directory the executing script is in. It does not, however, automatically include the directory an imported module is in. So, if you're executing "abc.py" directly, in finds "packagexyz" just fine, since it knows to look in the "packageabc" folder for modules. If you are executing "main.py" instead, the only place it looks (besides the default and manually configured paths) is "Project", so it can't find packagexyz. There's really three ways you could fix this: Manually configuring paths You can keep the imports as you have them and simply ensure that the "packageabc" folder is always on the search path for modules. You can do so either by configuring the PYTHONPATH environment variable to include it or by appending it to sys.path in your "main.py" before importing abc. Absolute imports You could also change the import in "abc.py" to be relative to "Project" (from packageabc.packagexyz.xyz import xyz). Then your "main.py" would work the way it is. Of course, that in turn means you can no longer directly execute "abc.py" unless you manually configure "Project" to always be on the search path for modules. Relative imports You could also change "abc.py" to use relative imports (from .packagexyz.xyz import xyz, note the extra dot in front). Then your "main.py" would work the way it is, as well. You could also still directly execute "abc.py", but only if you make sure to do it in a way that Python is aware it is part of a larger package (otherwise, relative imports give you an error). Specifically, you'd always need to execute it like this: python -m packageabc.abc Rather than like this: python packageabc/abc.py
🌐
TmuxAI
tmuxai.dev › stderr › python-module-not-found
Fix ModuleNotFoundError: No module named in Python - Meaning & Solution
Learn how to fix the 'ModuleNotFoundError: No module named' error in Python. Python cannot locate the library you are trying to import. Solution: Install the package: `pip install `.
🌐
Career Karma
careerkarma.com › blog › python › python modulenotfounderror solution
Python ModuleNotFoundError Solution | Career Karma
December 1, 2023 - A ModuleNotFoundError is raised when Python cannot successfully import a module. ... This error is encountered when you forget to install a dependency for a project. Because you haven’t installed the dependency, Python does not know where ...
🌐
Reddit
reddit.com › r/learnpython › "no module named x found"
r/learnpython on Reddit: "No module named X found"
March 11, 2024 -

I have been assigned a project and I need to do it using python. Now lately, I have been running into an error, "No module X found" in my VS code while I have already installed the modules via pip both using cmd and the terminal within VSC. I am running Python 3.12.2 (64-bit) interpreter. I have also edited the user/system paths to Scripts/ and Python312/ yet I still don't know what's causing the problem.

Also for some reason when I type: "python --version" In my cmd, I get a reply as "Python 3.9.13" which is a 2022 version and it's not even installed on my system so theres that.

Any help would be appreciated, thanks!