0

I want to write a guide to make the entrance to scripting in Abaqus as easy as possible. The first problem I stumbled upon is the "import"-command. I want to compile a list of every possible module to import, that is native to Abaqus. Out of the Documentation i got the following list:

from abaqusConstants import *             
from symbolicConstants import *         
import amplitude         
import animation        
import annotationToolset          
import assembly             
import caePrefsAccess            
import calibration          
import customKernel       
import deleteObjectCallback         
import displayGroupMdbToolset           
import displayGroupOdbToolset           
import field           
import fields           
import filter         
import inpParser           
import interaction            
import job         
import load               
import material       
import methodCallback           
import mesh          
import meshEdit             
import odbAccess          
import odbFilter             
import odbMaterial             
import odbSection      
import optimization               
import part              
import redentABQ            
import regionToolset          
import sketch             
import section                
import step              
import textRepr              
import upgradeScript                 
import visualization             

My problem is twofold.

First using the "Kernel Command Line Interface" I found a LOT more "import"-commands. I am guessing that most of them are somewhere contained in the ones i listed above. Confirmation or falsification of this idea is appreciated.

Second I found the following:

from abaqus import*

I know this contains some of the modules I listed, but I have no idea which ones in particular.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • Somewhere on your System, there is a file or folder called abaqus. `*` will import everything in there – user8408080 Dec 12 '18 at 18:30
  • What should this folder contain? It might help me find it. Thanks for the reply btw – Yannik Wagner Dec 13 '18 at 12:32
  • FYI `from abaqus import *` is very poor Python style because it pollutes the global namespace, and it means you can’t tell where a thing you reference was imported from, and it is possible abaqus will redefine something (by using the same name) you think you have already defined in your main script, or something in your main script might redefine something you think is defined in abaqus. I.e. it is very bad style particularly for maintainability. Also if you `import abaqus` You can print everything it defines by printing `abaqus.__dict__` (although there may be neater ways of doing this). – DisappointedByUnaccountableMod Jan 04 '19 at 18:40

1 Answers1

1

Based on this answer, here is the way to display every module that can be imported in Abaqus.

Execute the following in an Abaqus Kernel Command Line Interface.

>>> import sys
>>> for key in sorted(sys.modules.iterkeys()):
>>>    print "%s: %s"%s(key, sys.modules[key])
Rémy
  • 114
  • 11