Skip to content
Built-in Functions

globals()

Return the current global namespace dictionary.

globals()

globals() gives access to names defined at the top level of the current module. It is mainly useful for advanced dynamic code and inspection.

Returns

A dictionary representing the current global namespace.

Try it

Run it and change it
project = "PyQuest"
print(globals()["project"])

Related entries