I have an object:
class X():
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
whose attribute c, is a of list objects (of a different kind):
class Y():
def __init__(self, x, y):
self.x = x
self.y = y
I pickle this as follows:
import pickle
pickle.dump(instance_of_class_X,open(dir, "wb"))
I load as follows:
import pickle
from some_library import X, Y # I import the two classes involved
pickle.load(open(dir,"rb"))
I get the following error:
AttributeError: 'module' object has no attribute 'Y'
Not sure what to do, any help would be highly appreciated.