Hello, I am trying to solve an equation within a distributed loop. A MWE follows:

```
using Distributed
addprocs(2);
include("newfile.jl")
#Parameters:
par1 = 5;
par2 = 2;
@everywhere begin
using CSV, DataFrames, BlackBoxOptim;
end
@everywhere mod_pars = Dict("par1"=>$par1,"par2"=>$par2);
@everywhere par_values = collect(1:10);
@distributed for iv = 1:10
mod_pars["par1"] = par_values[iv];
myfun(mod_pars,iv);
end
rmprocs(workers())
```

where `newfile`

is just:

```
@everywhere g(mod_pars,x1,x2) = mod_pars["par1"]*((1.0 - x1)^2 + 100.0 * (x2 - x1^2)^2);
@everywhere function myfun(mod_pars,iv)
f(x) = g(mod_pars,x[1],x[2]);
res = bboptimize(f; SearchRange = (-5.0, 5.0), NumDimensions = 2);
df_tmp = DataFrame();
df_tmp[!,:values1] = ones(10)*mod_pars["par1"];
df_tmp[!,:values2] = ones(10)*best_candidate(res)[1];
CSV.write(joinpath("figures","data_"*string(iv)*".csv"),df_tmp);
end
```

This does not work with `@distributed`

but does without and I am not sure why. Any suggestions?

Thank you very much!