title: Killing a Python script from another script spawned from it
body: <p>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.</p>
  
  <p>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?</p>
  
  <p>These are what I have tried so far (without success):</p>
  
  <pre><code>import subprocess
  subprocess.call("killer.py")
  
  import subprocess
  subprocess.Popen(["killer.py"])
  
  import sh
  killer = sh.command("killer.py")
  killer()
  </code></pre>