I intend to save all my class variables at the current stage and load them later for replicating the same work. I tried to pickle all the object instance of the class but I guess since I created another sub object in the target object, it cannot pickle. My another solution is to pickle objects "self" to reload all the class wide variables for later use. Is it viable through pickle or what do you suggest?
For instance I have
class A:
...
class B:
...
def __init__():
self.A_ins = A
self.var1 = ...
self.var2 = ...
b = B()
f = open(file_name,'wb')
pickle.dump(b,f)
This is the error I got, if I try to pickle directly
TypeError: can't pickle instancemethod objects
In this example I try to save Class B object and reload it later. If it is not possible because of sub object A_ins, I propose to pickle self of class B object and reload it.