If you are working on code that runs a web server or some other service that is generally a long running application, take a look at hupper: https://docs.pylonsproject.org/projects/hupper/en/latest/
It is built specifically to restart things like servers as it was implemented for the Pylons Project (Pyramid web framework).