Relative Content

Tag Archive for pythonsubprocess

Why does sys.exit() not work with subproccess.run() or subprocess.call()

import tkinter as tk import subprocess import sys def start_newFile(): subprocess.call((sys.executable, ‘testing2.py’)) sys.exit() root = tk.Tk() root.title(“First Script”) # Function to start a new file def start_new_file(): start_newFile() # Button to start a new file start_button = tk.Button(root, text=”Start New File”, command=start_new_file) start_button.pack() root.mainloop() I’m a newbie CS student and I have this simple code […]