Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
If systemd-run works for you, that is probably the simplest thing you can do here. Otherwise, you can use os.fork() from within Python to spawn a child that stays alive after the parent exits. If...
Answer
#1: Initial revision
If `systemd-run` [works for you](https://linux.codidact.com/posts/289510#answer-289511), that is probably the simplest thing you can do here. Otherwise, you can use `os.fork()` [from within Python](https://software.codidact.com/posts/289509#answer-289512) to spawn a child that stays alive after the parent exits. If someone else is reading this based on the title, but is writing an industrial Python application that doesn't immediately exit, wants to schedule future tasks, and have those tasks be robust across various system events, neither of those solutions is likely to be as robust as using a dedicated service with a name like task scheduler, task queue, or message broker. [Celery](https://docs.celeryq.dev/en/stable/getting-started/introduction.html) is a good example.