I want to use multiprocessing to play and stop a sound file at any time, but when I start the process no sound was played.
from multiprocessing import Process
from playsound import playsound
def sound():
playsound('sound.mp3')
p = Process(target=sound)
p.start()
When I tried using sound()
on its own it works perfectly fine, but with multiprocessing it doesn't work.
Even if I add p.join()
, the code just finishes as soon as I start it, no sound gets played, and no error message is shown in the IDLE Shell.
How can I fix this?