That’s not possible inside of a function, only an ubergraph like the event graph.
Best practice is to set a variable on key press in the uber graph then access that variable inside your function. Key down > Set variable true. Key up > set variable false.
Ok, thanks for your answer, I thought that could be done. Then it would only be as follows. Although the variable thing would be nice, I think it would be overabundant in writing unnecessary work.