# Distributed: Calling a remote method on remote global

**URL:** <https://discourse.julialang.org/t/distributed-calling-a-remote-method-on-remote-global/17077>\
**Category:** New to Julia\
**Tags:** distributed\
**Created:** [November 2, 2018, 12:56am UTC](https://discourse.julialang.org/t/distributed-calling-a-remote-method-on-remote-global/17077 "2018-11-02T00:56:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andre/32/7455_2.png) [@Andre](https://discourse.julialang.org/u/Andre)\
**Post date:** [November 2, 2018, 12:56am UTC](https://discourse.julialang.org/t/distributed-calling-a-remote-method-on-remote-global/17077/1 "2018-11-02T00:56:25Z")

</div>

```julia

using Distributed
addprocs(1)

# Define a simple function:
@everywhere x2(x) = x^2;

# Create a float on the remote worker:
x = 5.0;
remotecall_fetch(()->x, 2);
remotecall_fetch(varinfo, 2)

# Change x on the main process and verify it has not changed on the remote process:
x = 100
remotecall_fetch(varinfo, 2)

```

How would I update the value of `x` on the worker process using function `x2()`? In other words, how to use `x2()` to update `x` to be 25.0 on the worker without transferring `x` through the main process?

In case additional context helps, the actual goal is:

The worker process collects regular data updates from a remote source. With each update it produces an output (call it VEC) which it sends to a function on the main process. This function (call it MAINFUNC) updates a variable (call it MYSTRUCT) that exists as a global on the main process. I would like the worker to be able to call MAINFUNC on the main process providing VEC and MYSTRUCT as arguments (where VEC exists on the worker and MYSTRUCT exists on the main process).

Any insights greatly appreciated - thank you!
