you could record the pid of the bot in a file after you kick it off  then kill the bots by using os kill even if you continue using  ps a i think it is better to use python s re and os modules than shelling out to grep awk and kill 