Best way to save and load widgets and hundreds of objects of the QGraphicsItem class

Hello, good afternoon. I am developing an application in PySide6 where I want to save and load the state of several widgets and also the state of several objects of the QGraphicsItem class, which can number in the hundreds. What would you recommend so that I can perform this task in the most efficient way?