You almost got it.
Best to detect in the input function.
func _input(event):
if event is InputEventKey and event.pressed:
if event.scancode != KEY_ENTER:
#Do what you gotta do.
If you wanna know what key you are pressing, then that's what that scancode
variable in the second if is. However if you print it out as it is it would return an integer.
#Eg: If I pressed A then this would print 64.
print(event.scancode)
That integer is a KeyList enumerator in GlobalScope. Which means you have to compare it against one of those constants to know if it's that key in particular.
#Eg: Now this would print true if I pressed A.
print(event.scancode == KEY_A)
There are more that you can find here under Enums > KeyList.