Set up notebooks so that symbols in one will not interfere with symbols in another, a technique useful for creating scratch notebooks for computational experiments.

Using the Menu...

In a notebook with the default context settings, new symbols are created in the Global` context:

Give a second notebook a unique context so that symbols created in it will not interfere with symbols created in the first notebook. With the second notebook frontmost, choose Evaluation Notebooks Default Context Unique to This Notebook:

Symbols in the second notebook are created in a context unique to that notebook:

Since Global`x in the first notebook is different than Notebook$$676$251903`x in the second, setting the value of x in the second notebook does not affect the value of x in the first:

  • Packages loaded in other notebooks are unavailable to notebooks with unique contexts.

Programmatically...

In a notebook with the default context settings, new symbols are created in the Global` context:

Set up a second notebook so that it creates symbols in a unique context:

Symbols in the second notebook are created in a context unique to that notebook:

Since Global`x in the first notebook is different than Notebook$$676$251903`x in the second, setting the value of x in the second notebook does not affect the value of x in the first:

  • Packages loaded in other notebooks are unavailable to notebooks with unique contexts.