✊🏿 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!

Storing objects in dcc.Store()

Hello!

Is there a way to store an object within a dcc.Store()? I have several serial devices that are hit/miss working with Dash, and only Dash. I need them to put data into a csv so the Dash graphs will update in real time. But I am having issues with them sometimes not connecting, or not staying connected keeping the object creation within my main App.py file.

I think storing these somewhere else could fix this, but I am struggling with a number of errors when trying to return the serial objects in a callback.

If anyone has any other ideas on how to do this, I am open to hearing as long as I can perform methods on the objects when certain booleanswitches are toggled.

You could try the jsonpickle library.

Thanks for your input! :slight_smile:

Unfortunately pyserial objects cannot be pickled apparently. Besides, I think that would just cause it to re-pickle the objects on each reload anyways. There are all these examples of using serial but none of them work for this exact reason. Clearly somebody knows how to get around this because there is almost zero discussion on this topic, and I know I’m not the only one.