In Python, every loaded package has a global workspace, where all global variables are saved. The main workspace of itom is a huge dictionary, containing all variables as well as method and function pointers and loaded packages and modules. The content of this global workspace is listed in the toolbox Global Variables. There is a filter, such that all variables of type method, function and type (classes...) are not listed in that overview. If you want to access items of this global workspace you can directly access them by their variable name, e.g.:
>>print(__name__)
'__main__' #answer
However, this is only possible if you work in the command line or a script that is not part of a separate module. In this case, you can access items of itom‘s global workspace by importing the module __main__:
import __main__
print(__main__.__dict__["__name__"])
Note
In Python, every module or package has its own global workspace. The main global workspace depicted in the toolbox is related to the global workspace of itom that is always accessible by other modules using the dictionary __dict__ of the __main__-module.
The toolbox local variables is only enabled if you are currently debugging a python script and the execution is stopped at a breakpoint or in a certain line. Then, the current workspace (local scope) of the method, where the debugger has been stopped, is shown. If the debugger currently processes any code not contained in a method, no local workspace is available.
Double-clicking on an item opens an small dialog where the content of the variable is printed. This is the same result as:
print(VARIABLENAME)
The context menu, depicted in the figure above shows some important methods of this toolbox. Most of them are also accessible by the toolboxes toolbar. You can always delete one or multiple selected variables or you can rename one selected variable. Additionally, there is the possibility to import or export variables to or from this workspace.
A click on import opens a file dialog where you can choose a specific file to import. The following file formats are loadable:
Note
Existing variable names will be replaced unless the variable points to a class, method or function.
If you selected one or multiple variables and click on export , another file save dialog is shown where you can choose a specific filename in order to export the variables. You can export into the following file formats:
In both the file open and save dialogs, the filter list always considers all file formats that are available for import and export on your computer.
All variables which are defined in python console or in any python script are stored as global variables. These can be seen in the Global Variables Toolbox.