So what I was planning to do was loop over a list which contains path to my sound files and play them using pygame.mixer module in python, but when I did this the problem I encountered was pygame always play the last most index path file from the list, and rest were skipped. Example if my list contains 2 items:
music_list = ['abc.mp3', 'gef.mp3']
for music_index in range(len(music_list)):
mixer.init()
mixer.music.load(music_list[music_index])
mixer.music.play()
then it never plays abc.mp3 file and directly plays the last file gef.mp3
time.sleep
after theplay()
. You're playing both files, just immediately one after the other