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!