I am trying to save the instance of a Python object to a file.
My problem is that when I use pickle.dump()
and then pickle.load()
it works if and only if I am in the same file. If I do pickle.dump("dump.pkl")
in ‘file A’ and pickle.load("dump.pkl")
in ‘file B’, I get get following error:
AttributeError: Can't get attribute 'xxxxx' on <module '__main__'>
Would there be a way to make this work? What I want is to be able to dump my object in a file and then, If I send this file to someone else who only knows about this file (not about the class of the instance I dumped), he can reconstruct the instance on his side.
Thanks