How to Use Python to Run an App in a New Process: Best Practices?

18 Replies, 1793 Views

Yo! I’ve been in the same boat with Python run app in new process. Honestly, `subprocess` is great if you’re running external apps, but for internal stuff, `multiprocessing` is the way to go.

To avoid zombie processes, you can use `daemon=True` when creating the process. It’ll automatically kill the child process if the main one exits.

Also, `atexit` is a bit overkill unless you’re doing something super complex. Just wrap your process in a try-except block and handle cleanup there. Cheers!

Messages In This Thread



Users browsing this thread: 1 Guest(s)