How to stop the python program halfway (without manually shutting down)

is there anything like, after running a python program, I will finish two python programs directly after running the other one? I hope you can give me some advice

.
Mar.07,2021

can I use threads?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf919e-32155.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf919e-32155.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?