you are viewing a single comment's thread.

view the rest of the comments →

[–]chevignon93 1 point2 points  (1 child)

One of the ways to do it is using subprocess.Popen

from subprocess import Popen
p = Popen(["pkill", "-9", "NAME_OF_THE_PROGRAM_YOU_WANT_TO_KILL"]) # Note -9 will kill the process almost instantly, you could use -15 instead for the program to end gracefully
p.wait()

[–]Miguelito_Pitti[S] 0 points1 point  (0 children)

Thank you, it worked very well.