'pyinstaller-ModuleNotFoundError, How to incl module which added manually by __init__.py in pyinstaller

I have my_ui.py and resources_rc.py are automatically generated from a QT GUI designer.

I can run my_ui.py using python my_ui.py.

This is my-module structure

\my-module
 \__init__.py
 \my_ui.py
 \resouces_rc.py

Content of init.py. resource_rc will be imported and later used inside my_ui.py

   from my-module import resources_rc
   sys.modules['resource_rc'] = resources_rc

pyinstaller command:

pyinstaller --paths=resources_rc.py myui.py --onefile

I got an error message when running ./dist/my_ui

ModuleNotFoundError: No module named 'resources_rc'

I have tried to run pyinstalled outside my-module directory and still i get this error message.

Any idea how to solve this problem? Many thanks.



Sources

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

Source: Stack Overflow

Solution Source