I have a pickle file that I need to load from another project. It seems that the folder structure of that project is a little different. i.e: The model class was defined in main, but in my project, it put in "model.fraud_model.py". So when I try to load the pickle file, I get this exception:
'module' object has no attribute 'FraudModel'
I'm trying to modify the pickle file from this:
ccopy_reg
_reconstructor
p0
(c__main__
FraudModel
To this:
ccopy_reg
_reconstructor
p0
(cmodel.fraud_model
FraudModel
And it works. But this solution will change pickle file. I don't want this. So I import by hand:
from model.fraud_model import FraudModel
import sys
sys.modules['model.fraud_model'] = FraudModel
But it seems not work. Please help me how to fix this.
Thanks