Help with MRI scanner trigger, key suppression

Hi All,
I’m encountering an issue in my code where the trigger from the MR scanner sends input to my terminal, when I need to interact with it still. There was a key disabling function in PsychToolBox that looks like this (from an old script):


Is there anything similar in PsychoPy? Or does anyone have any easy fixes to do this simply in Python?
Thank you.

Ok, my solution was to use the keyboard library in Python with the following functions:


A bit wary of this solution though.