# Update list based on external file

I am writing an addon to help me manage my multi-file addons.

Its coming along really nicely, but I want it to work no matter what .blend file I have open, so I have it save each project's data to an xml file.

Not knowing that it wouldn't work, I had the panel call two functions, one to update the files for the project, and one to update the xml file. So whenever the UI updated the two functions were called. But I changed something in the 2nd function that actually changed a value in blender and it wouldn't let me because you can't edit blender data from a UI context.

So here is my question: What is the best way to continually update my list based on this external XML file. I really don't want a UI button to update from xml if possible.

Also, if there is a way for the two functions to be run whenever Blender opens that would work as well.

• Just out of interest: Why XML? – p2or Aug 9 '15 at 9:17
• @poor because each project has a name, location, a boolean for whether it is an addon or a script, and a list of files in the project. I hadn't ever used XML before and I thought it would be an easy way to store/parse data. And it was. :D – Nathan Craddock Aug 9 '15 at 15:17
• JSON is much simpler however. Anyway, how often are the updates supposed to happen? – CoDEmanX Aug 9 '15 at 19:06
• @CoDEmanX I hadn't thought of JSON.. I will look into that once I fix this problem! But minimum it should update when the addon is enabled (the register function, I can already do this) and whenever blender is opened with the addon already enabled. It would be nice for it to be continually checking for new projects in the xml file, but it doesn't need it. – Nathan Craddock Aug 11 '15 at 16:15
• Have a look here: blender.stackexchange.com/a/7974/1363 (populate_coll() and register()) – CoDEmanX Aug 17 '15 at 19:18