I have two Python scripts on a Linux system. Let's call them service and killer. Service is run as a systemd service and killer as a script. Killer exists to perform certain tasks that can't be executed while service is running due to limited hardware resources and the will to keep the code simple.
What I need is to be able to start killer from service and then have killer kill service without dying itself (as a child process). How can I do that?
These are what I have tried so far (without success):
import subprocess
subprocess.call("killer.py")
import subprocess
subprocess.Popen(["killer.py"])
import sh
killer = sh.command("killer.py")
killer()