I have prepared a python automation script, I want to design a GUI button which should have the only function to run the script instead of run a command like below in terminal.
python3 media/path/xyz.py
You can either use os.startfile()
or subprocess.call()
Here is a small example for your reference
from tkinter import *
import os
#import subprocess
root=Tk()
def run_p():
os.startfile('media//path//xyz.py')
#Or
#subprocess.call('C:\\myprogram.py')
btn=Button(root,text='Click',command=run_p).pack()
root.mainloop()