Exploiting parallel Julia's auto-global shipping from inside functions and other submodules?

The fact that Julia automatically ships globals from Main to workers for you is a super useful construct,

using Distributed
addprocs(1)

x = [1,2,3]

@fetch x .+ 1  # x was shipped to worker here
@fetch x .+ 2  # x wasn't shipped again since its unchanged

@everywhere 2 @isdefined(x)  # true

But put that same code inside another module and it doesn’t work because this only works for globals in Main. Or put it inside a function and now x isnt a global, so both @fetch commands will send x as part of a closure (which is unwanted if x is something big and costly to send).

So is there any way to hook into the same machinery that works for globals in Main but from other places? Guessing you could do it with lots of @eval Main ... but hoping maybe there’s a better solution. Also there’s no doubt some more by-hand solutions you could do but really I just want the same mechanism that works in Main to take care of checking whether an object has changed and needs to be resent for me.

Related behavior sometimes can cause headache:

So I don’t think it’s a good idea to be too automatic about this