import time import threading import pygame def play_sound(path): pygame.mixer.init() sound = pygame.mixer.Sound(path) sound.play() time.sleep(sound.get_length()) def start(): def countdown_thread(): for i in range(3): play_sound("app/static/sounds/beep.wav") time.sleep(1) play_sound("app/static/sounds/go.wav") threading.Thread(target=countdown_thread).start()