Q:

How to open a program from my computer in python?

Im making a window in tkinter and I can't figure out how to run an external program in python. I am using the full path and am getting no errors, the file is just not loading.
I've tried os.startfile(path) but that doesn't open the file.
Here is my code:
from tkinter import *
from tkinter import ttk
import os

def run_selected():
    if ver.get() == "Test":
        os.startfile(path)

master = Tk()

ver = ttk.Combobox(master, state="readonly", values=["Test"])
ver.pack()
Button(master, text="Run", command=run_selected).pack()

master.mainloop()

How do I fix this so that I can open the file?
EDIT: My (path) is "C:\Backup\Mindustry\Mindustry.exe"

A:

You can spawn a process using many different ways. Check here and here
One of the ways could be
import subprocess

def run_selected():
    if ver.get() == "Test":
       subprocess.run([path], check=True)
       # e.g. subprocess.run(["ls","-ltr"], check=True)

However, since you are spawning it from Tkinter, you could spawn it from a different thread (unless process ends within milliseconds), else, the default Tkinter thread will get busy and the UI will appear frozen

