✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Extract a dict value instead of string from a callback_context

For my project I wanted to use the new pattern matching functionality. One problem I ran into is that I actually want to access the variable which is MATCHed inside the callback, because in this case it is some index that is then used deeper in the program. I could not find a built-in way to do it, so I kinda did one myself.

My question: Is there actually a better way to do this? Some official support on plotly side?

And for those wanting to do a similar thing in the future, this is what I used (when inside the callback function):

ctxt = callback_context