Editor scripting + input event

Hello everybody!
I started writing a tile editor using the Editor utility widget. I figured out how to get the coordinate in the viewport using getlevelviewportcamerainfo, the problem remains how to catch the input when pressing a certain key in the viewport to process the tile. Allows input to be used in editor utility widget? Or is it imperative to use the lower-level c ++ API? Thank you!