grab_focus()
is just a function that sets the focus on the control it's called on. So, you can't set it to a boolean value as you're attempting to do.
To set the focus on $Button
, you simply need to call $Button.grab_focus()
. If you need to first see if $Button
already has focus, you can call $Button.has_focus()
.