How to bind key with a funciton within widget blueprint?

Hi,
I am new in UE4 and I am working in a project where I need to test a widget functionality for OSD (Game HUD).
I am planning to add a key binding and call a function withing the widget blueprint to replicate the behaviour.
However, I am sure how to bind a key with a function inside a widget blueprint.

I tried to create a key mapping inside Project>Settings>Input
However, inside my widget blueprint (Designer>Graph) I could not find the mapping to connect it with the function.
Can anyone suggest me the correct way to do it?

What I want to do is make a text box visible or invisible based on the function call.
The text box is added to my HUD widget. I want to make it visible when teh function is called.
and the text should become invisible after some time (probabaly using a timer?)

I need to test this mechanism with a test key binding (for example alt+M).

Thanks,
M

Could you please clarify this section?
“Now first add the when input press and reless so now going back to the widget make a bool name it buttonP(or something else) now go back to the other blueprint, cast to The widget then get the new bool and connect of to the press.”

OK so after creating the input create a blueprint or use a blueprint. Now first add the when input press and reless so now going back to the widget make a bool name it buttonP(or something else) now go back to the other blueprint, cast to The widget then get the new bool and connect of to the press. And turn the function to true. Now for The timer: first create two integers one named timer and the other timer end. OK so now that we got that add every tick function add a seqel thing and connect a delay and then make it to were it adds a 1+ to of every time. Then on the other thing on The seqel make of check of if the timer is greater then or = two the timer end, make it turn the bool we added to false and make the timer to 0. This is not complete so you will need to add something if you need help just ask!

yeah sure ok so your getting the input you just made, then after that you are going back to the widget you made, and at that widget you are making a bool(boolean), then going back to the blueprint that you are calling the input, then you get a cast to(try casting it to the widget you have) then connect it to were you get the input(the one part that says press)