Pyinstaller ModuleNotFoundError with self created package

Viewed 94

I'm trying to bundle my app into an executable file using PyInstaller using the command pyinstaller --onefile --icon=icon.ico --windowed .\app.py

Here's my hierarchy:

    .
├── app
├── __init__.py
├── Interfaces
│   ├── __init__.py
│   ├── mainmenu.py
│   ├── login.py
│   .
    .
    .
├── app.py

The app.py does import a file from inside Interfaces package like this:

from Interfaces.mainmenu import MainUI

Howver as I launch the executable, this error occurs:

ModuleNotFoundError: No module named 'Interfaces'

As a side question, can I send the created exe to another computer and run it without having to install any extras?

1 Answers

Managed to solve it by explicitly importing "Interfaces" at the top of my app.py file:

import Interfaces
from Interfaces.mainmenu import MainUI
Related