Built-in Functions and Types
globals()
Access the actual dictionary for the current module’s global namespace. Within a function this refers to the module in which the function was defined, not the module that calls it. Changes to this mapping can change global bindings, so prefer explicit variables or configuration mappings for ordinary program state. The mapping is not a copy or a sandbox boundary.
Formal Syntax & Structure
python syntaxpython
globals()Return Value
dict
Live module-global namespace mapping.
Working Example
Example Snippetpython
app_name = "ByteMind"def label(): return globals()["app_name"]
print(label())print(globals() is label.__globals__)