0

So I tried to call a thread in another thread in order to run function in a function using two CPU but it didn't work.Can you guys help me pls?

import threading
import time
def Func1():
    pass
    print(1)
    time.sleep(2)
    
def Func2():
    pass
    Func1()
    print(2)
t1 = threading.Thread(target=Func1)
t2= threading.Thread(target=Func2)
t1.start()
t2.start()
t2.join()
  • The `threading` module will not run two threads on two CPUs if you are using CPython (https://stackoverflow.com/a/1294402). Consider using `multiprocessing` instead. – tfpf Nov 22 '22 at 12:11

0 Answers0