Storing custom classes

I wrote a python-scriptable component wich calculates a bunch of objects wich are all of the same type (a custom class).
I also implemented the possibility to recalculate only parts of the solution via booleans.

What I would like to do is make the component store its calculated results so that they are available after re-opening the grasshopper file. (Calculations take up to 40 minutes so I dont wan’t to be forced to recalculate every day) Is there a way to do this?

Best Regards,

Maybe write these results to a file and when you restart check if the file exists and then check if you want to recalculate or not?

It will be difficult as you do not get to participate in file IO when using script components, so you need to find some other way to include your data. You could perhaps ‘slave’ a Generic object parameter to your script and use that as storage, but then you still need to deal with how to write and read your data. Perhaps the easiest solution is to convert your data to strings (either directly from byte arrays or maybe via xml), since GH knows how to store strings.

@jordy1989 's suggestion of using separate files gives you the most control, but it does mean having to juggle multiple files which can confuse users.