Hi guys I have two different processes running at the same time.
I’m trying to stop the other process which i have named loop_b
but I have only managed to stop the current process and the other doesn’t stop
from multiprocessing import Process
import time
import sys
counter=0
def loop_a():
global counter
while True:
print("a")
time.sleep(1)
counter+=1
if counter==10:
print("I want to stop the loop_b")
sys.exit()
#Process(target=loop_b).close() -> Also i tried this but not worked
def loop_b():
while True:
print("b")
time.sleep(1)
if __name__ == '__main__':
Process(target=loop_a).start()
Process(target=loop_b).start()