Создание и удаление scriptJob

Прио открытии скрипта создаем job.

UnitsCheckerJob = cmds.scriptJob( runOnce=False, event=['linearUnitChanged', self.UnitChanger])

Перед закрытием находим его и убиваем.

try:

CurrentJobs = cmds.scriptJob( listJobs=True )

if any("linearUnitChange" in s for s in CurrentJobs):

UnitJob = filter(lambda UnitJob: 'linearUnitChange' in UnitJob, CurrentJobs)[0]

UnitJobNumber = UnitJob.split(':')[0]

cmds.scriptJob( kill=int(UnitJobNumber))

print "PolygonTools:

UnitsCheckerJob was deleted. Job#: ", UnitJobNumber

except:

print "PolygonTools: Cant delete UnitsCheckerJob."