# How to set shared variable from "Get"

I load some file by Get, as: Get[file.m]; I want that functions from this file will be defied for all Kernels, what I have to do?

Thank you!

• ParallelEvaluate[Get[file.m]]? Curiously, there is a ParallelNeeds but no ParallelGet. Aug 29 '18 at 15:04
• ... no comments, of course, thanks a lot! Aug 29 '18 at 15:06
• You're welcome. Aug 29 '18 at 15:09
• @HenrikSchumacher ParallelNeeds does more than ParallelEvaluate[Needs[...]]. It registers that Needs command to run on any newly started kernel, even if those kernels are started after evaluating the ParallelNeeds. The thinking may have been that with such a drastc change to the parallel environment, file.m better be a proper package rather than some script. Aug 29 '18 at 15:13
• What you can also do is apply DistributeDefinitions to the stuff in file.m. This will be robust against starting new kernels. Aug 29 '18 at 15:14

ParallelEvaluate[Get[file.m]]