Calling Messages that Delete Objects

 
 
 

In Python, before calling APPLICATION_CLOSE_SCENE or any message that deletes objects, make sure you are not holding on to Python variables that point to one of the objects you are about to delete. The easiest way to reset those variables is to del them.

self.sendMessageSync('APPLICATION_LOAD_SCENE', (file, ), )
# ...
model = self.document().get(ModelIO.id)
# ...
del model
self.sendMessageSync('APPLICATION_CLOSE_SCENE', (), )