func _input(ev):
if ev is InputEventKey and ev.scancode == KEY_K:
#code
or
func _input(ev):
if Input.is_key_pressed(KEY_K):
#code
or if you want to run the code only once per press
func _input(ev):
if ev is InputEventKey and ev.scancode == KEY_K and not ev.echo:
#code
I do recommend using the input map though. Much easier.