See my Article:
Speeding up access to PD-Objects
you can adopt it for your needs/objects, there is also a property to save the actual model (from activemodel) because when you open a new model in your code with a diagram that new one becomes the activemodel and your code can fail/show strange behaivor
dj