10

Is there a robust way to ensure that a package is always loaded on startup, even in parallel kernels?

Parallel kernels do not read Kernel/init.m.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263

1 Answers1

8

The Autoload mechanism can be used for this. Place the package in $UserBaseDirectory/Autoload or $BaseDirectory/Autoload.

However, the package must follow the standard structure, and must have a Kernel/init.m file, otherwise it won't get loaded.

Also keep in mind that auto-loading of packages happens only after $UserBaseDirectory/Kernel/init.m was loaded (on the main kernel; subkernels don't load the standard kernel init.m because they are launched with -noinit).

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263