How to dynamically add/enable attribute template in maya?

I have defined my template xml files and stored it somewhere, but I don’t want to add the path to MAYA_CUSTOME_TEMPLATES on maya startup, My little pyqt gui creates a ui and a transform node with some dynamics attributes in maya. Is it possible to do the following to enable the template on the fly?

putenv MAYA_CUSTOM_TEMPLATE_PATH "/path/to/my/templates";
refreshCustomTemplate;

I have tried the above command and it doesn’t work. It seems I have to put the path into the environment variable first, then launch maya to make maya see it. Is there a way to force attribute editor to rebuild ?

The old method of deleting attribute editor window doesn’t work any more.(since qt is used)


deleteUI AEWindow;
// Error: line 1: deleteUI: Object 'AEWindow' not found. //

edit: It’s solved after I rebooted my machine, should have done that earlier … orz