import subprocess import time # Define the path to PowerShell 7 executable powershell_path = "pwsh" # Define the commands to run in each PowerShell instance command1 = f"{powershell_path} -Command python app.py" command2 = f"{powershell_path} -Command npx tailwindcss -i ./src/input.css -o ./static/output.css --watch" # Start the first PowerShell 7 process process1 = subprocess.Popen(command1, shell=True) # Start the second PowerShell 7 process process2 = subprocess.Popen(command2, shell=True) try: # Keep the script running indefinitely while True: time.sleep(1) except KeyboardInterrupt: # If the script is interrupted (e.g., Ctrl+C), terminate both processes process1.terminate() process2.terminate() process1.wait() process2.wait() print("Both processes have been terminated.")