You can create custom property associated to a data type like this:
bpy.types.Objects.MyProperty = bpy.props.IntProperty ()
So now all objects have this interger property and it's entrered value is saved with the blendfile. Same thing with Scene , NodeTree , Nodes ... etc.
But where I can save a value available for the entire blendfile? Not associated to something can be added or removed from the blendfile by the user. A kind of top node in the datablock. I find a place but not really sure it's a good idea:
bpy.types.WindowManager.MyProperty = bpy.props.IntProperty ()
I can retrieve it to:
Thanks a lot !