# Confusing behaviour of include("source.jl") in parallel codes

**URL:** <https://discourse.julialang.org/t/confusing-behaviour-of-include-source-jl-in-parallel-codes/115295>\
**Category:** General Usage\
**Tags:** question, parallel, distributed\
**Created:** [June 6, 2024, 7:38pm UTC](https://discourse.julialang.org/t/confusing-behaviour-of-include-source-jl-in-parallel-codes/115295 "2024-06-06T19:38:42Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [June 7, 2024, 6:40pm UTC](https://discourse.julialang.org/t/confusing-behaviour-of-include-source-jl-in-parallel-codes/115295/7 "2024-06-07T18:40:46Z")

</div>

> [@singularity](#):
>
> Let’s have a source.jl file containing the following code:
> 
> `x_worker = $x`

In general, I would move your thinking away from “running scripts”, where you want to substitute some values into global variables in the script in order to control its operation.

Instead, write _functions_ (and ideally, for any nontrivial amount of code, [put the functions in a module in a package](https://discourse.julialang.org/t/best-practise-organising-code-in-julia/74362/2)), and then _call_ the functions with different parameters to control their behavior.

---

_[View the full topic](https://discourse.julialang.org/t/confusing-behaviour-of-include-source-jl-in-parallel-codes/115295)._
