Dec-11-2019, 01:36 AM
Here is my code:
include the main python that run this code. My question is how can I close the specific python file?
if mybuffer == "b'Python'":
print("Python File Opening")
thislist = [r'"py_exe.py"', r'"MQTT_pub.py"'] #add path here
for x in thislist:
print(x)
Popen("python " + x)
if mybuffer == "b'Close_Py'":
thislist = [r'"python.exe"'] # add path here
for x in thislist:
print(x)
os.system("TASKKILL /F /IM " + x)
print("Python was closed")this code is can run but.My problem is when I close thie python file it's will close all of python file that running in processinclude the main python that run this code. My question is how can I close the specific python file?
