I do not know exactly what problems you encounter, but maybe try this:
func _input (event):
You made an onready variable and then didn't use it. Moreover, are you sure that this
$SpotLight is a proper reference to the light in question? You might wanna check that this
$SpotLight actually references something and that it's not
null. The above code will work if you place it directly on the Light node in question.