ClearAll["Global`*"] stops working with Context set to 'unique to this Notebook'

As soon as you set your notebook context to 'unique to this Notebook', the notebook's context is no longer Global`, but, well, unique to the notebook.

I can't test right now, but assuming you are not in an explicitly opened context (like after Begin or BeginPackage), I think the following should work:

ClearAll@@{$Context<>"*"}

At least it works in a kernel with manually changed $Context.


I think instead of ClearAll["Global`*"], you can just Clear["`*"]. This should work.