ResourceIdentifier.set_referred_object(referred_object, warn=True)[source]

Binds a ResourceIdentifier instance to an object.

If it already a weak reference it will be used, otherwise one will be created. If the object is None, None will be set.

Will also append self again to the global class level reference list so everything stays consistent. Warning can be ignored by setting the warn parameter to False.