Using keyboard response as a conditional cue to other components

Dear PsychoPy experts,

In my experiment, there is polygon_1 on the screen at first, and then I want to show polygon_2 in response to the participants’ key press (here using K key). And importantly, I want to do this in a single routine, not by ending the routine with the key press and showing polygon_2 in the next routine.
I made this work by inserting a code key_resp.getKeys('k') to the start column of polygon_2 in stand-alone PsychoPy Builder.
Though it doesn’t work on pavlovia. It skips polygon_1 and starts with polygon_2 like the condition code key_resp.getKeys('k') is already TRUE from the beginning. I tried to replace the code with key_resp.key == ['k'] and some other patterns that I think of, but any of it works (apparently I don’t know much about javascripts)
Is there any ideas on this?

Thank you in advance.

Give

if (key_resp.getKeys == 'k'):
 here comes your code

a try.

Cheers Jens