This python script is part of a project but that doesn't have relevance. The script is attempting to use the pygame mixer module to load a wav file and play it; this works fine if I input the same code line-by-line in shell but not if I put it into a script and attempt to run it.
from pygame import mixer
mixer.init()
mixer.music.load('sound.wav')
mixer.music.play()
If I run the script line-by-line in shell, the sound plays through the speakers fine but if I put it into a script and do 'python3 playSound.py' then the audio file does not play.