...
Code Block | ||
---|---|---|
| ||
import it def getCatalog(name): ''' return a catalog by name, if not found then create a new one. ''' model = it.app.GetModel() for cat in model.GetCatalogs(): if cat.GetLabel() == name: return cat cat = it.app.NewCatalog(name) return cat |
If you editing acmd.py heavily as you develop your code you might not want to keep quitting "it" to get it to reload acmd.py. We can't use python's reload() command because, for various reasons, acmd.py is not loaded as a python module. We can fix this by not loading acmd.py directly and instead using a intermediate loading script that does load import acmd.py as a module.
First modify you it.ini file to point to the intermediate file:
...