# Current $Context of a given notebook nb = CreateDocument[{Dynamic@$Context}, CellContext -> Notebook]


It will show Notebook22$93500 or something similar. How to get this context value without interfering with nb too much? You should also assume we do not control nb generation. Unfortunately AbsoluteCurrentValue[nb, CellContext]  Notebook FrontEnd knows it: How does the Kernel know the$Context in a localized notebook, the question is if user can access it.

• You want the notebook context when the notebook does not have CellContext -> Notebook set in its preferences? – Edmund Feb 2 '19 at 13:01
• @Edmund for any case except CellGroup/Cell because then it does not make sense. But we can say: "what is the context in First@Cells[nb]. Then this makes sense for every scenario – Kuba Feb 2 '19 at 13:58
• @Kuba this is something I’ve tried to figure out many times and I still have no idea how. The “switch context” functions in the "FE" context get called when you evaluate anything in the notebook but I don’t know where the context gets pulled from. – b3m2a1 Feb 3 '19 at 5:36
• @Kuba, the FE does not provide a mechanism to query for what that value might be. – ihojnicki Feb 4 '19 at 14:14
• @ihojnicki Thanks for feedback. Somehow I was not notified about your comment. – Kuba Feb 11 '19 at 7:39