# How to broadcast already defined function to all worker processes in jupyter？

**URL:** <https://discourse.julialang.org/t/how-to-broadcast-already-defined-function-to-all-worker-processes-in-jupyter/38194>\
**Category:** General Usage\
**Tags:** jupyter, distributed\
**Created:** [April 25, 2020, 1:39pm UTC](https://discourse.julialang.org/t/how-to-broadcast-already-defined-function-to-all-worker-processes-in-jupyter/38194 "2020-04-25T13:39:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pingzi\_Kang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pingzi_kang/32/14318_2.png) [@Pingzi\_Kang](https://discourse.julialang.org/u/Pingzi_Kang)\
**Post date:** [April 25, 2020, 1:39pm UTC](https://discourse.julialang.org/t/how-to-broadcast-already-defined-function-to-all-worker-processes-in-jupyter/38194/1 "2020-04-25T13:39:33Z")

</div>

Hello everyone,

I am a beginner for Julia. When I use `Distributed` to speed up my program, I found such a problem: I have defined a large number of functions and constants in `Jupyter`, if I need to use `Distributed`, then I must add `@everywhere` before each function, which is inconvenient and not conducive to code portability.

**So, how to broadcast already defined function to all worker processes in `jupyter`? And don’t need to modify the previous definition.** If the previous function must be redefined, it will be sad.

For the constants, I can use

`@async @everywhere constant0, constant1`

to broadcast. But for the functions, this will not succeed.

I hope someone can guide me. Thank you very much!

---

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [April 25, 2020, 2:18pm UTC](https://discourse.julialang.org/t/how-to-broadcast-already-defined-function-to-all-worker-processes-in-jupyter/38194/2 "2020-04-25T14:18:24Z")

</div>

I believe usually what people do is do:

```julia
@everywhere include("<file>.jl")

```

So that everything in the file is loaded into all the instances. So put your startup code in one file (or files), your implementation in other files, then have your startup code load the implementation onto all instances using the `@everywhere include`.

This assumes that all instances have access to the source files…
