for x in sceneDefs where x.name==#joyStickContainer do
try(custAttributes.deleteDef x)catch(print x.name)
Simple enough function, check to see if the def exists and try and delete it. getOwner returns undefined when I check it as well. The def has been assigned to a modifier in the scene and then Max has been reset. At that time I try and do a clean up of unused defs and it will not remove it.
Here is a simple test script. Am I getting rusty from all the modeling that I have been doing as of late? Why does this error?
addModifier t ah
custAttributes.add ah def
--Now try and get rid of it.
testDefs=for x in defs where x.name==#test collect x
testInstances=for x in testDefs collect custAttributes.getDefInstances x
for x in testInstances do print (custAttributes.getOwner x)
for x in testDefs do custAttributes.deleteDef x