get_tree().has_group("your group name")
The first method
get_tree returns the
SceneTree the node calling the method is in. And
has_group checks if the
SceneTree calling it has the group named "your group name". The method returns true if the group exists, i.e. there is at least a node in the group.