How to use ray.put() with a regular python class instance defined in another python file?

Hi, I try to instantiate a Python class from another python file and then use ray.put() to store the instance into the object store. The code is like this:

import ray
import myclass

instance = myclass.model()

then such a mistake has occurred:

File “C:\Users\win10\AppData\Local\conda\conda\envs\drl\lib\site-packages\ray\util\client\”, line 407, in _put_pickled
raise cloudpickle.loads(resp.error)
ModuleNotFoundError: No module named ‘myclass’

Process finished with exit code 1

I guess this is because the file is not in the same directory with
How could I solve it?

I solve it by starting the head node in the path where I store the code!

1 Like