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!

  • 1
    $\begingroup$ ParallelEvaluate[Get[file.m]]? Curiously, there is a ParallelNeeds but no ParallelGet. $\endgroup$ Aug 29, 2018 at 15:04
  • $\begingroup$ ... no comments, of course, thanks a lot! $\endgroup$ Aug 29, 2018 at 15:06
  • $\begingroup$ You're welcome. $\endgroup$ Aug 29, 2018 at 15:09
  • 2
    $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Aug 29, 2018 at 15:13
  • 2
    $\begingroup$ What you can also do is apply DistributeDefinitions to the stuff in file.m. This will be robust against starting new kernels. $\endgroup$
    – Szabolcs
    Aug 29, 2018 at 15:14

1 Answer 1


Turning a comment into an answer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.