Record keypresses in different window

similar question here: Record Key Presses in Background Window - #2 by whs_shw

We are using the psychopy module in a script to collect in-scanner button responses. The stimuli are being presented by a different program (neurofeedback software called FRIEND), which required this its own window to be open. However, for our script to collect responses, it appears that we have to ensure that the terminal window (or whatever window was used to run the script) is open and selected. When the stimuli presentation software window is open and maximised, however, no keypresses are recorded. This is not ideal as we need to have the stimuli presentation software open.

I’m confused because I thought psychopy simply logged all keystrokes in the keyboard buffer, regardless of what window was selected.

Is there anyway for psychopy (specifically, the keyboard class) to collect responses ‘in the background’?

Thank you in advance

hello @whs_shw ! We are running into the same issue trying to using the psychopy module to collect in-scanner responses (where stimuli are being presented in a different window using a different library). Any chance you’ve found a workaround? I was wondering whether there was some way to re-route or forward keypresses?