# Distributed parallelism within packages/applications

**URL:** <https://discourse.julialang.org/t/distributed-parallelism-within-packages-applications/14320>\
**Category:** Julia at Scale\
**Tags:** question\
**Created:** [August 30, 2018, 2:19pm UTC](https://discourse.julialang.org/t/distributed-parallelism-within-packages-applications/14320 "2018-08-30T14:19:37Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![SebastianM-C](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastianm-c/32/2480_2.png) [@SebastianM-C](https://discourse.julialang.org/u/SebastianM-C)\
**Post date:** [August 31, 2018, 9:31am UTC](https://discourse.julialang.org/t/distributed-parallelism-within-packages-applications/14320/7 "2018-08-31T09:31:57Z")

</div>

Thanks for the answers!  
I am trying to load some files on all workers, but I am not sure how to do it properly.  
Considering the example in the first post, I changed the contents of `ParallelTest.jl` to:

```julia
__precompile__ (false)

module ParallelTest

using Distributed
@everywhere using Pkg
@everywhere Pkg.activate(".")

@everywhere include("$(@ __DIR__ )/parallel.jl")

@everywhere using .PMod

greet() = print("Hello World!")

end # module

```

and added another file `parallel.jl` in the `src` directory containting:

```julia
module PMod

println("loaded")

end # module PMod

```

I managed to load the module successfully, but I get redefinition warnings for the module loaded in parallel.

```julia
(v0.7) pkg> activate .

julia> using Distributed

julia> addprocs(2)
2-element Array{Int64,1}:
 2
 3

julia> using ParallelTest
[Info: Precompiling ParallelTest [0e712700-ac5e-11e8-3696-ef47f8f04c4e]
loaded
      From worker 3: loaded
      From worker 2: loaded
      From worker 2: WARNING: replacing module PMod.
WARNING: replacing module PMod.
      From worker 2: loadedWARNING: replacing module PMod.

      From worker 3: WARNING: replacing module PMod.
loaded
loaded
      From worker 2: WARNING: replacing module PMod.
      From worker 2: loaded
      From worker 3: loaded
      From worker 3: WARNING: replacing module PMod.
      From worker 3: loaded

```

I also tried to use `using .PMod` instead of `@everywhere using .PMod`, but I get a `LoadError` saying that `PMod` is not defined. I think that the problem is that on the workers it’s in the global scope, while on the master process is inside a module.

---

_[View the full topic](https://discourse.julialang.org/t/distributed-parallelism-within-packages-applications/14320)._
