import dill
# Save the file
dill.dump(myObject, file = open("myObject.pickle", "wb"))
# Reload the file
myObject = dill.load(open("myObject.pickle", "rb"))
import pickle
myobj = MyObj()
# save obj to file
with open('myfile.pkl', 'wb') as f:
pickle.dump(myobj, f)
# read obj from file
with open('myfile.pkl', 'wb') as f:
obj = pickle.load(f)