How to build multiple .py files into a single executable file using pyinstaller?

Suppose you had a file called create.py like

def square (num)
    return num ** 2 

Another file in the same directory called input.py

from . import create
def take_input():
    x = input("Enter Input")
    return create.square(x)

And finally your main.py

from . import input
if __name__ == '__main__':
    ip = input.take_input()

You will call the command –

pyinstaller --onefile main.py

And pyinstaller will import all the dependencies of all the files itself

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)