Exchange information between screens

Hello!!! So I'm doing a project for an automated house and inside it I'm using two screens, one for the lower floor and the other for the upper floor, inside these floors I placed rooms and inside them switches and then I press the on switch and it turns on an image When the lamp is on and I press off, the lamp appears off but when I change the screen it loses this data, how would I make sure this data is saved? If you can help me, thank you, I would like the data from both screen 1 and screen 2 to be saved

The best way would be to use a TinyDB. Save all of the switches (in a list of dictionary) when a suitable action is performed (when one of the switches is pressed) , and load them on Screen Initialization.

The problem is that I don't know how to create block language using images, I have no idea how to put this in the list and in logic, But Thank you very much