Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Document stale globals caveat on ctx.globals (#8802)

Trevor Manze191472b1a42
diff --git a/marimo/_code_mode/_context.py b/marimo/_code_mode/_context.py
index 331f0dbc8c..3b0e4c1131 100644
--- a/marimo/_code_mode/_context.py
+++ b/marimo/_code_mode/_context.py
@@ -434,7 +434,12 @@ class AsyncCodeModeContext:
@property
def globals(self) -> dict[str, Any]:
- """The kernel's global namespace (all variables defined by cells)."""
+ """The kernel's global namespace (all variables defined by cells).
+
+ Mutations via :meth:`run_cell` update the kernel globals but
+ *not* the scratchpad's copy. Read values through this property
+ (``ctx.globals["x"]``) rather than bare variable names.
+ """
return self._kernel.globals
@property