Search code examples
pythonmoduleauto-py-to-exe

If I convert a python file from py to exe, what about the module I created that the file imports?


MG3KWS is the directory for this module and KWS is the module itself that I created for the client file

I created a server and client file and I was about to convert it to exe when I realized that I also need to convert the module it uses to exe. What do I do about the module?


Solution

  • It looks like Auto PY to EXE uses PyInstaller to do the real work here:

    A .py to .exe converter using a simple graphical interface and PyInstaller in Python.

    PyInstaller will automatically bundle any dependencies it finds:

    What other modules and libraries does your script need in order to run? (These are sometimes called its "dependencies".)

    To find out, PyInstaller finds all the import statements in your script. It finds the imported modules and looks in them for import statements, and so on recursively, until it has a complete list of modules your script may use.

    So as long as you import your dependencies somewhere reachable from your main script and your virtual environment is active, you should get the right behaviour automatically.

    Note that you'll probably need to build two executables: one for your server and a separate one for your client.