import subprocess import os # Path to Python in the virtual environment python_path = os.path.join("env", "bin", "python") # Run this.py p1 = subprocess.Popen([python_path, "ini_dia.py"]) # Run main1.py p2 = subprocess.Popen([python_path, "main1.py"]) # Optional: wait for both to complete (remove if you want them to run independently) p1.wait() p2.wait()