Set Up Initialization to Run whenever a Session Starts

Write code that automatically runs at the beginning of every kernel session.

Programmatically...

Use SetOptions to change the InitializationCellEvaluation and InitializationCellWarning options for a given notebook:

  • SetOptions can also be used on a directory of notebooks.

Using the Option Inspector...

Open the Option Inspector

Open a notebook, and go to Format Option Inspector... ( ), then select Notebook Options Evaluation Options:

Change the initialization cell evaluation option

In Evaluation Options, set InitializationCellEvaluation to True:

Change the initialization cell warning option

In Evaluation Options, turn off the warning message by setting InitializationCellWarning to False:

Notes

It is recommended to use these features for automation only, e.g. turning off cell warnings and initializing cells for a trusted directory of notebooks.
It is not recommended to change these options in Global settings for security reasons.