# How do I get a clean slate after every run of my add-on?

So I have been working on an exporter as part of my Google Summer of Code project. As I am new to Blender add-on development, I was under the impression that my code would get a clean slate every time it ran, specially when the register / unregister methods were implemented.

Unfortunately my code has been exhibiting some very weird behavior! It is basically as if all the data structures are being cached by the Python interpreter, and all code is being executed several times.

As GSOC projects are open source, you can check the source itself on Github, but it is far from complete yet.

All runs of the exporter produce a debug log with some of the operations carried out. It also helps convey my problem more precisely. Here's the successful output after a run on the default scene. Now here's the incomplete output on the second run of the same scene. Even though it crashes, it is clear that all lines are basically duplicated.

For the record, I am using vscode with this add-on for development. Please let me know if any more details are needed for this question!

• I've taken a quick look and it seems you reload on every execution of the export operator. Perhaps this causes the problem? github.com/dwlsalmeida/ramses-blender/blob/… Jun 15 '19 at 19:42
• Actually I have added this in an attempt to fix it, it sadly does not help nor break anything. Jun 15 '19 at 19:44
• Not sure if I'll have time to investigate this further, but I would think you either happen to have a bug in reloading which results in two instances of RamsesExportOperator being registered or that some list isn't properly reset and you keep appending state which results in multiple executions when iterating over it. Jun 15 '19 at 20:09
• IMO re-registering the addon is not the way to go. Executing an operator that is registered by the addon,that is unregistering and re-reregistering itself is confusing. Register it once.. Any property value you do not wish saved after running an operator use the bl_options = {'SKIP_SAVE'} to return to defaults on next run. Jun 16 '19 at 12:19
• If I comment that line nothing changes. See someone with the same issue blender.stackexchange.com/questions/46990/… Jun 16 '19 at 13:03