ParallelDataTransfer.jl with local variables

I want to pass a variable to my workers inside a function (see minimum example below) but I get stuck on passobj. I assume this is because passobj is evaluated at the global scope where the variable is not defined? Is there any way to get this to work?

I work on 0.5.1 for ParallelDataTransfer and Julia 1.8.4.

using Distributed
addprocs(4)

@everywhere using Distributed, ParallelDataTransfer

function testPass(a::Vector{Float64})
passobj(1, workers(), [:a])
end

testPass(rand(10))

You cannot pass to a local function because that is global dynamic data. What you can do is pass it to a worker that then reads that information in a function by using a global variable. So you’d do:

function f(x)
   x + a
end

and if you send a to your worker then it can update the global a. You can that get more sophisticated if you can reference and update the reference after the send.