# Best way to transfer Ray object refs

**URL:** <https://discuss.ray.io/t/best-way-to-transfer-ray-object-refs/9495>\
**Category:** Ray Core\
**Created:** [February 24, 2023, 7:24pm UTC](https://discuss.ray.io/t/best-way-to-transfer-ray-object-refs/9495 "2023-02-24T19:24:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marsupialtail](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/marsupialtail/32/1950_2.png) [@marsupialtail](https://discuss.ray.io/u/marsupialtail)\
**Post date:** [February 24, 2023, 7:24pm UTC](https://discuss.ray.io/t/best-way-to-transfer-ray-object-refs/9495/1 "2023-02-24T19:24:14Z")

</div>

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

Let’s say worker A puts an object into the object store and gets an object ref X. I would like to serialize X and give it to another worker B, who can then call ray.get(X).

Is this even ppossible?

---

<div class="post-metadata">

**Author:** ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)\
**Post date:** [February 24, 2023, 11:30pm UTC](https://discuss.ray.io/t/best-way-to-transfer-ray-object-refs/9495/2 "2023-02-24T23:30:27Z")

</div>

You can just pass it to the other worker. In your case, I assume worker B is an actor (otherwise there is no worker). And you can pass object ref to B by calling B’s remote method. You should put the X into a list to defer the dereference.

---

<div class="post-metadata">

**Author:** ![marsupialtail](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/marsupialtail/32/1950_2.png) [@marsupialtail](https://discuss.ray.io/u/marsupialtail)\
**Post date:** [February 25, 2023, 3:49am UTC](https://discuss.ray.io/t/best-way-to-transfer-ray-object-refs/9495/3 "2023-02-25T03:49:45Z")

</div>

Does this error make sense to you by any chance?

> > > ray.cloudpickle.loads(r.get(b’FOT-0’))  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > File “/home/ziheng/miniconda3/envs/quokka-dev/lib/python3.8/site-packages/ray/util/client/common.py”, line 95, in **init**  
> > > self.\_set\_id(id)  
> > > File “/home/ziheng/miniconda3/envs/quokka-dev/lib/python3.8/site-packages/ray/util/client/common.py”, line 186, in \_set\_id  
> > > self.\_worker.call\_retain(id)  
> > > AttributeError: ‘NoneType’ object has no attribute ‘call\_retain’

---

<div class="post-metadata">

**Author:** ![marsupialtail](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/marsupialtail/32/1950_2.png) [@marsupialtail](https://discuss.ray.io/u/marsupialtail)\
**Post date:** [February 25, 2023, 4:11am UTC](https://discuss.ray.io/t/best-way-to-transfer-ray-object-refs/9495/4 "2023-02-25T04:11:41Z")

</div>

I think I have a better understanding of what’s going on @yic . The thing that I am passing to ray.cloudpickle.dumps() is a ClientObjectRef. I am trying to loads it in a remote actor started by same client. If I just loads it in the client it works fine. But trying to load it in the remote actor causes problems. Makes sense to me since it’s called ClientObjectRef, and the error tries to go do some stuff in ray/util/client which presumably the remote Ray actor can’t do.
