I am having a Python page named Home.py and it is containing a button named View Reports. When I click this button I want another Python page named Reports.py to get executed. I developed the UI using tkinter.
1 Answer
Try the below code. Works for me.
def RunWrapper():
wrapper = ['python', 'Reports.py']
result1 = subprocess.Popen(wrapper, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out1, err1 = result1.communicate()
status_wrapper=out1.decode("utf-8")
tkinter.messagebox.showinfo("Execution of script is done")
Button.configure(pady="0",text='''Execute''',command=RunWrapper)
subprocessto execute the external script. Or if the main block is inside a function in the external script, import the function and call the function.subprocess? Post the test code.pythonto execute theReports.pyscript?