# Passing ARGS to multiple workers

**URL:** <https://discourse.julialang.org/t/passing-args-to-multiple-workers/47457>\
**Category:** General Usage\
**Created:** [September 29, 2020, 2:04am UTC](https://discourse.julialang.org/t/passing-args-to-multiple-workers/47457 "2020-09-29T02:04:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkashaev](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nkashaev](https://discourse.julialang.org/u/nkashaev)\
**Post date:** [September 29, 2020, 2:04am UTC](https://discourse.julialang.org/t/passing-args-to-multiple-workers/47457/1 "2020-09-29T02:04:24Z")

</div>

I am trying to pass an argument from the terminal to a program that uses multiple cores. But ARGS appear to be visible only on the first worker. How can I push ARGS to all workers?  
For example, suppose test.jl contains

using Distributed  
addprocs(1)  
@everywhere model=ARGS[1]  
println(model)

When I run in the terminal  
julia test.jl Hello

worker 2 does not see ARGS variable and Julia throws an error.

---

<div class="post-metadata">

**Author:** ![lucas711642](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucas711642/32/12051_2.png) [@lucas711642](https://discourse.julialang.org/u/lucas711642)\
**Post date:** [September 29, 2020, 2:30am UTC](https://discourse.julialang.org/t/passing-args-to-multiple-workers/47457/2 "2020-09-29T02:30:28Z")

</div>

As described in the [manual](https://docs.julialang.org/en/v1/stdlib/Distributed/#Distributed.@everywhere), `@everywhere` does not capture variables, so you need to interpolate them:

```julia
@everywhere model=$(ARGS[1])

```

---

<div class="post-metadata">

**Author:** ![nkashaev](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nkashaev](https://discourse.julialang.org/u/nkashaev)\
**Post date:** [September 29, 2020, 2:36am UTC](https://discourse.julialang.org/t/passing-args-to-multiple-workers/47457/3 "2020-09-29T02:36:57Z")

</div>

It works. Thanks a lot.
