I mean while you transfer python to executable, if the following python script has some modules imported, how will any other device will run the executable file if it doesn't have python installed without the modules?
The generated executable is essentially a packaged combination of the python interpreter and the compiled (.pyc) files, including any imported packages that might be necessary.
Something that I don't understand about python to executable file