'PyInstaller - ModuleNotFound error when importing other python files

I'm making an app in python with a multi-folder structure that looks like this:

/
├── .git (Obv Im not gonna post my entire .git folder here, that would be a wall and a half)
├── .gitignore
├── icon
│   ├── PyZlogo.png
│   └── PyZlogo.xcf
├── LICENSE.md
├── make
├── make.ps1
├── pyz-workspace.code-workspace
├── README.md
└── src
    ├── docs
    │   ├── pyz.1.MD
    │   └── pyz-plugm.1.MD
    ├── main.py
    ├── pluginmgr
    │   └── manager.py
    ├── shell
    │   ├── rccreator.py
    │   └── shell.py
    └── unnecesarrycode
        ├── INFO.MD
        ├── shell.py line27
        └── shell.py line55

And I use PyInstaller to build my app into a binary so that the end-user doesn't need a python interpreter installed. But recently, it broke in such a way that when I build it using my make script.

mkdir -p bin/Linux
cd bin/Linux || exit 2

pyinstaller --onefile ../../src/main.py ../../src/shell/rccreator.py ../../src/shell/shell.py ../../src/pluginmgr/manager.py

It throws a ModuleNotFound error. But it works completely fine when running the source code! The error looks like this:

Traceback (most recent call last):
  File "main.py", line 8, in <module>
ModuleNotFoundError: No module named 'shell'
[39266] Failed to execute script 'main' due to unhandled exception!


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source