Hi,
I’ve used the following lines to add properties to components that can be used in callbacks:
def add_property(self, property_name, property_value=None):
"""Add a property to the component that can be read/fetch by callbacks
Parameters
----------
property_name : str
property_value : int or float or str or bool
"""
# Add a property
self.__setattr__(property_name, property_value)
self.add_property_name(property_name)
def add_property_name(self, property_name):
available_properties = self.__getattribute__("available_properties")
available_properties.append(property_name)
prop_names = self.__getattribute__("_prop_names")
prop_names.append(property_name)
It used to work however, now I got “Invalid prop for this component” Error while it’s working and it ignores the
prevent_initial_call=True
in the callback.
Is there another way to add properties to components or to prevent this error?
Thank you for your answers.
Best regards