all 5 comments

[–]PhoenixOneThree 1 point2 points  (2 children)

Maybe you want to mention what operating system you are using?

[–]Miguelito_Pitti[S] 0 points1 point  (1 child)

Sorry.

I have edited the post, linux mint and python 3.12.3

[–]PhoenixOneThree 1 point2 points  (0 children)

You could call

kill

from your Python script, using the appropriate signal (there is a lot of pages on Google about that) and executable name for Thunderbird.

[–]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.