# Modify a remote object

**URL:** <https://discourse.julialang.org/t/modify-a-remote-object/10612>\
**Category:** Julia at Scale\
**Created:** [April 29, 2018, 10:08pm UTC](https://discourse.julialang.org/t/modify-a-remote-object/10612 "2018-04-29T22:08:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [April 30, 2018, 1:38am UTC](https://discourse.julialang.org/t/modify-a-remote-object/10612/4 "2018-04-30T01:38:47Z")

</div>

> [@bbrunaud](#):
>
> In your example, is global n the variable in worker 1 or worker 2?

worker 2.

> [@bbrunaud](#):
>
> I want to move an object to another worker and modify it in place iteratively.

Maybe something like:

```julia
addprocs(1)

@everywhere begin
    defineA(src) = global const A = src
    incrementA() = (A .+= 1)
    getA() = A
end

```

Test it out:

```julia
p = 2
B = zeros(Int,2,2)
remotecall_fetch(defineA, p, B)
remotecall_fetch(getA, p)
remotecall_fetch(incrementA, p)
remotecall_fetch(getA, p)
B

```

.  
You might also want to look at: [How to avoid repeated data movement between processes?](https://discourse.julialang.org/t/how-to-avoid-repeated-data-movement-between-processes/9835)

See also [ParallelDataTransfer](https://github.com/ChrisRackauckas/ParallelDataTransfer.jl), which provides helper functions for transferring data between worker processes.

---

_[View the full topic](https://discourse.julialang.org/t/modify-a-remote-object/10612)._
