I have enum class, that is generated based on distinct names in Postgres table, like this.
CustomProperty = StrEnum('CustomProperty', [(i['metric_name'], i['metric_name']) for i in PostgresConnection().distinct_metrics()])
That is, when the application is loaded, the CustomProperty class gets initiated and stores the list of available properties.
Sometimes there appears to happen that new metrics are added to the table, but they are not getting dynamically added to this CustomProperty. So I need to reload the application, to reinitiate the class. I want to re-/initiate the class generation on call of certain function. How can it be done?