I am trying to create a GCP cloud function which loads a pickled python object for use.
The pickle is stored as a byte string.
The function fails when loading the pickle with the error:
"Can't get attribute 'MyClass' on <module 'google.cloud.functions.worker' from '/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py'>"
From that I am assuming the issue is due to namespace, as when the object is created it is stored in <module '__main__'>
I found Unable to load files using pickle and multiple modules which is useful but I don't think either of the solutions would be possible to implement in cloud functions.
How would I go about loading a pickled object which was pickled outside of the function?
N.B I do have the MyClass class in the function.