# Load file on workers after they start

**URL:** <https://discourse.julialang.org/t/load-file-on-workers-after-they-start/87502>\
**Category:** Julia at Scale\
**Tags:** distributed\
**Created:** [September 20, 2022, 5:41am UTC](https://discourse.julialang.org/t/load-file-on-workers-after-they-start/87502 "2022-09-20T05:41:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit.Rotem](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amit.rotem/32/206257_2.png) [@Amit.Rotem](https://discourse.julialang.org/u/Amit.Rotem)\
**Post date:** [September 20, 2022, 5:41am UTC](https://discourse.julialang.org/t/load-file-on-workers-after-they-start/87502/1 "2022-09-20T05:41:03Z")

</div>

Is it possible to load a jl file on a worker as they start?  
The `-L` flag does not seems to work.

```julia
using Distributed
open("worker_startup.jl", "w") do io
    print(io, """
        using Distributed
        id = Distributed.myid()
        println("worker \$(id) started !!")
        """)
    close(io)
end
addprocs(1; exeflags="-L worker_startup.jl")
@everywhere @show id

```

The point of this is that if I have an `@async` task that starts workers on a cluster, I can start a `pmap` call without waiting for all the workers to start.  
Hoping that newly added workers will load their startup file, and then join the worker pool of the already running `pmap` call

```julia
task = @async for k=1:10
    sleep(1)
    addprocs(1; exeflags="-L worker_startup.jl")
end

pmap(q->(sleep(1); rand()+myid()), 1:10)

```
