How to get all nodes that are currently referencing a specific resource instance?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RrR2010

Hello!
I’m trying to making a CustomButtonGroup resource type and I want to be able to get all nodes that are referencing a specific instance of this resource.
The scenario I’m trying to do is:

In my CustomButtonGroup I have

extends Resource
class_name CustomButtonGroup

var group_name: String

func get_all_buttons():
    #Here I want to be able to retrieve the buttons that references this instance
    var buttons_array = get_referencing() or get_dependents() or...
    return buttons_array

func execute_custom_function():
    for button in get_all_buttons():
        if not button is CustonButton: return
        button.custom_function()

And this is my CustomButton:

extends Button
class_name CustomButton

var custom_button_group: CustomButtonGroup

func custon_function():
    #Execute some code

I know that I can define the var custom_button_group as setget and every time it’s changed, I append self inside an array in CustomButtonGroup, but I don’t want to do this way because I will use various types of buttons I don’t want to create the setget on all then. Futhermore, I want to performe this operations in other situations too.
I was looking about ResourceLoader and ResourceFormatLoader but I cannot understand the documentation (because I’m new to godot yet - 1mo)