Python: Executing multiple functions simultaneously
I m trying to run two functions simultaneously in Python. I have tried the
below code which uses multiprocessing but when i execute the second
functions starts after the first is done.
from multiprocessing import Process
def func1:
#does something
def func2:
#does something
if __name__=='__main__':
p1 = Process(target = func1)
p1.start()
p2 = Process(target = func2)
p2.start()
No comments:
Post a Comment