function scope behaves differently on local job

I'm trying to run a script as a local job. In the script, I call a function that has a structure

afunc <- function(localData){
print(nrow(globalData))
....
}

where globalData is a variable in the global scope. This works fine in the console, or when just sourcing the script. This errors when using a local job.

Any ideas? Is this just terrible practice on my side?

Thanks!

Have you tried running the job with a copy of the local environment?

I have - I get the same behavior

Can you provide a minimal REPRoducible EXample (reprex) illustrating your issue?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.