This question already has an answer here:

I often digress to test some others’ code when working on my own problems. Usually, I have to check if there are conflict variables. Of course, it is not a wise way. By contrast, all the variables in Mathematica documentation center are parallel to the user’s opened notebook, even if they share the “same” name, that’s because they are in different context.

So, how to make the context of a new notebook different from the working one at the time they are opened?If this can be done, I won’t bother to restart Mathematica or clear all my variables to test them.

What’ more, is it possible to prevent the code from crushing the working kernel and front-end, even if there are serious bugs?

I guess that if the notebook can be opened in different kernels and different front-ends at the same time, all the irritating problem will be solved. But I don’t know how to do that.


marked as duplicate by rcollyer, user21, Yves Klett, István Zachar, whuber Mar 25 '13 at 13:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ The first answer tells you how to set it up to automatically do this. $\endgroup$ – rcollyer Mar 25 '13 at 12:53
  • $\begingroup$ @rcollyer Thanks a lot. I will check that. $\endgroup$ – luyuwuli Mar 25 '13 at 13:00

This command creates a new context every time it's run, (from second to second):-

 CellContext -> StringJoin["context$",




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