I have a python script that is responsible for verifying the existence of a process with its respective name, I am using the pip module pgrep, the problem is that it does not allow me to kill the processes with the kill module of pip or with the of os.kill because there are several processes that I want to kill and these are saved in list, for example
pid = [2222, 4444, 6666]
How could you kill those processes at once? since the above modules don't give me results.