Importing Python modules from a select location Importing Python modules from a select location selenium selenium

Importing Python modules from a select location


I had the same issues with PyInstaller when they switched to version 3.0 and Nuitka solved it for me.

You could bundle your Main.py into a .pyd lib file and then create executables for 1.py and 2.py which would import all needed packages from this "dll". Hence you could put your lib file into a specific location and set the PYTHONPATH accordingly right before launching your executables (e.g in a batch file or directly in your shell configuration).


I have investigated this further, and believe the solutions presented here to be the answer I am after

Using onefile is not possible as this feature is presently broken.

To address my first concern, UPX and virtual directory. Then lastly, putting all the files into one dir. Lastly, putting the exe's in the folder like I have done in the picture will mean I have a reduced file.

I could create shortcuts through a python script (if this is still a concern), however there is no real need and running all the exe's in that one folder is more than fine by me I have found. They may fix the onefile in the future, but I am more than satisfied with this solution.

As a result:Smaller File.

Can I run these exe's where ever I want on that pc? Sadly, no not without multipackage-bundles which is broken. You could create a shortcuts though which is not as bad as I thought it to be. Though they may fix that in the future but in the mean time this solution is as good as it will get. Feel free to correct me if I am wrong, but I am happy with this solution.