Say I have an app made with tkinter that I want to compile into an .exe file. In this program I use base64 strings so that any user can read the images within the app without needing to download any other image files (see Embed icon in python script). Since those strings can take up a lot of lines, I can make another .py file with the base64 strings and just import the strings as variables from that other file into my main file. However, if I use pyinstaller to compile my main file into an .exe, will it compile the other .py file with the base64 strings as well, or do I absolutely have to write the base64 strings and the tkinter app in one python file? :)
Asked
Active
Viewed 62 times
1 Answers
0
It will compile the other .py file with the base64 strings as well.
PyInstaller inspects the import statements in your code and automatically compiles all the modules that your code uses. If you are using something tricky like dynamic imports then it may not always work, but for normal imports you shouldn't need any special configuration. Take a look at the PyInstaller docs on "finding the files your program needs" for more details.
In fact, you can also break your main Tkinter file up into different modules to make it easier to maintain, if you so choose.

Jack Taylor
- 5,588
- 19
- 35