title: How to exit out of a Python Script while the script invoked by it still continues to run
body: <p>I have two python scripts out of which one of them does some processing from the data in a excel file. The second script is used to update the data whenever the user updates the excel. After the user modifies the xlsx file he/she can run the second script and it automatically reloads the second script. However the problem here is that since the first script that does the actual processing is having a infinite while loop and when I am executing the file from the second script it doesn't exit after executing the first py file. I just want the second script to execute the first python file once and then exit out while the first script keeps executing infinitely. Here is the code:</p>
  <pre><code>import notification
  import importlib
  import subprocess
  import os
  import sys
  
  importlib.reload(notification)
  if os.name == 'nt':
      subprocess.run([&quot;python&quot;,&quot;notification.py&quot;], capture_output=True)
  else:
      subprocess.run([&quot;python3&quot;,&quot;notification.py&quot;], capture_output=True)
  sys.exit(0)
  </code></pre>
  <p>Here the name of my first file is notification.py.</p>