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

18 Replies, 1555 Views

Hey there! For Python run app in new process, I’d recommend `multiprocessing` over `subprocess` unless you’re dealing with external binaries.

One thing to watch out for is shared resources—make sure you’re using `multiprocessing.Queue` or `multiprocessing.Manager` if you need to pass data between processes.

As for clean exits, you can use `signal` module to catch termination signals and clean up gracefully. Also, check out this guide on Real Python—super helpful for this kind of stuff: [link].

Messages In This Thread



Users browsing this thread: 2 Guest(s)