Python – Pyinstaller – Multiple python scripts

Pyinstaller – Multiple python scripts… here is a solution to the problem.

Pyinstaller – Multiple python scripts

I have two Python scripts that generate a GUI and run code on some buttons. From the Python run, I run mainImpactTool.py and then run impactTool.py to generate the GUI.

  • mainImpactTool.py
  • impactTool.py

I followed the guidance here:

https://pythonhosted.org/PyInstaller/usage.html#what-to-bundle-where-to-search

So I can create an executable that runs on Windows.

If I have a script, I usually run :

Pyinstaller --onefile mainImpactTool.py

However, in order to use two scripts, I did this :

Pyinstaller --onefile mainImpactTool.py impactTool.py

Pyinstaller works, but I get an error when I run the .exe file:

ImportError ... Failed to execute script mainImpactTool

Any suggestions for what I did wrong?

Thanks

Solution

Pyinstaller --onefile mainImpactTool.py

Try this and it will work. Pyinstaller recursively recursively all-imports (impactTool.py) and include them in the .exe.

Related Problems and Solutions