'How to compile a python script containing threads to .exe?

I have a working code using threading.Threads() to run 2 separete WebSocket conections, each in separete scripts from main.py. Im trying to compile the main script to an windows .exe file, which was successfully done, but the .exe can't access both threads, only the first one declared (threading.Thread(target=finange).start()).

main.py body:

if __name__ == '__main__':

    print('\nThread Finance Iniciated')
    threading.Thread(target=finange).start()
    print('\nThread Exchange Iniciated')
    threading.Thread(target=edi).start()

How can I compile a python file that make use of threads to a .exe file capable of running all threads?

Obs: The compilation to .exe was made twice, first using pyinstall, then auto-py-to-exe, both presented the same issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source