function pass_object(src::Int, target::Vector{Int8}, name::Symbol; from_mod=Main, to_mod=Main)
r = RemoteChannel(src)
@sync @spawnat(src, put!(r, getfield(from_mod, name)))
@sync for to in target
@spawnat(to, Core.eval(to_mod, Expr(:(=), name, fetch(r))))
end
end
variable1 = some_data
@sync pass_object(1, pid, :variable1)
result = @spawnat pid Core.eval(Main, :(new_variable=variable1))
Julia 1.5.3
I tried multiple ways how to pass object to another worker and then use the assigned variable, but the result is always that it is not defined. There are no errors before I try to access its attribute, e.g. remotecall_fetch(println, pid, new_variable.label)
Any ideas why this does not work? Thank you for any help.