Python app building help

Hey folks, new to this site(obviously).

Was wondering if I might pick some brains for a programming wall I keep hitting with this app I am trying to write.

I need help capturing and transporting global bluetooth signals from my phone receiver and using those captured presses to toggle a function within my app.

I have the mediasession listeners in place, but Python3 keeps fighting me about using them to actuate the function I need it to.

Any help would be greatly appreciated.