How to get exact time of key press when routine is not forced end by keypress?

psychopy3
v2023.2.3
Windows 10 Enterprise

Hi,
I have question regarding the timing of key press from keyboard routine. I’m using the builder view in Psychopy because I’m new to programming. I’ve set up an experiment for an EEG study. I need to add response trigger based on response from key press.
In my keyboard routine of 2.0 second, participant can respond anytime during 2.0 seconds, however i need to know the exact time when participant pressed the key. Considering the nature of experiment, I cannot stop the routine using the force stop of routine by key press.
I need a code for coder component which will help me to find the time when key was pressed, i have tried to use the information from previous discussion however i am unable to get the code suitable for this situation.

Thank you in advance

If your keyboard component is called key_resp then the RT will be saved as key_resp.rt