6.7 Accessing kernel data from the GUI

You can use the kernelAccess module to query the GUI-side mdb and session objects. The mdb and session objects in the kernelAccess module mirror their counterparts in the kernel. As a result, the mdb and session objects in the kernelAccess module are updated whenever the mdb and session objects change in the kernel. The GUI-side mdb and session objects provide only query access to their kernel-side counterpart’s attributes—they do not allow access to the object's methods.

You can obtain values from the mdb and session objects using the ABAQUS Scripting Interface. For example,

from kernelAccess import mdb, session 
partNames = mdb.models['Model-1'].parts.keys() 
odbNames = session.odbs.keys() 

Although you can import the kernelAccess module in a script that is executed before the application startup script has completed, you cannot query the mdb and session objects until the application startup script has completed. In other words, you can import the kernelAccess module in your scripts in code that is executed during the initial construction of the GUI; however, you should not attempt to access either the mdb or session object until it is needed because of some user interaction in the GUI. For more information, see Startup script, Section 11.2.