from signal import pause
from os.path import isfile, join

from gpiozero import Button








def btn_pressed(index):
    global btn_array
    #btn_array[index].when_pressed = None
    #btn_array[index].when_released = lambda: resetBtn(index)
    print('keeps pressing')
    
    """
    def resetBtn(index):
    global btn_array
    
    #if(sound_playing):
    print('btn released')
    btn_array[index].when_released = None
    btn_array[index].when_pressed = lambda: btn_pressed(index) """

btn1 = Button(21)
btn1.when_pressed = lambda: btn_pressed(0)
#btn1.when_held = None
#btn1.when_released = lambda: resetBtn(0)

btn2 = Button(13)
btn2.when_pressed = lambda: btn_pressed(1)
#btn2.when_held = None
#btn2.when_released = lambda: resetBtn(1)

btn_array = [btn1, btn2]

pause()

