People seem to suggest that one needs to start a new kernel to keep multiple Mathematica (MMA) notebooks independent e.g. Kernel management link. But I did not do so and still found my two notebooks running independently.

I opened the first notebook and entered


Then, in the second notebook, I entered


and it gave me


instead of '3' thereby indicating that the two notebooks are independent. When I go to 'Evaluation >> Quit Kernel', I find only one option 'Local' in both the notebooks indicating that both notebooks are using the same kernel 'Local'.

So, how can multiple notebooks run independently despite being on the same kernel?

enter image description here

  • 6
    $\begingroup$ Are you looking for the CellContext "Notebook" setting in the Option Inspector window, which you can reach via the Advanced Preferences in the Preferences panel? Beware that while this splits context between notebooks, it doesn't mean you can execute code in one notebook while the other is doing stuff (like a long-running command) $\endgroup$
    – Carl Lange
    Jun 5, 2019 at 14:01
  • 4
    $\begingroup$ How are you opening your two notebooks? Could it be that you're really running two instances of the Front-End, which a separate "Local" kernel each? You can check the context setting as suggested by @CarlLange (you can also evaluate $Context in both notebooks and see whether it's the same), and you could start a computation in one notebook (like Pause[15]), and try to evaluate something in the second while this is still running (as @CarlLange said, the second evaluation should be blocked if it's the same kernel for both notebooks). $\endgroup$
    – Lukas Lang
    Jun 5, 2019 at 17:20
  • $\begingroup$ Did you set Evaluation -> Notebook's Default Context -> Unique to this notebook? $\endgroup$
    – Szabolcs
    Jun 6, 2019 at 17:38
  • 3
    $\begingroup$ Lukas is right: it looks like you are running two separate instances of Mathematica. How do you know it's the same kernel? Did you check $ProcessID? $\endgroup$
    – Szabolcs
    Jun 7, 2019 at 6:54
  • $\begingroup$ Yes, I was running two separate instances of MMA. $ProcessID showed two different numbers. Only when I start a new notebook by File>>New Notebook, the notebooks share the same variable name and the notebooks show the same ProcessID which was not the case for my above question. Thank you all. $\endgroup$ Jun 7, 2019 at 15:58


Browse other questions tagged or ask your own question.