Thank you for your comment! I do know about that... The reason that I'm removing them one by one and then connecting the new ones is the bug in my script. If I connect a new file address using Ctrl+Shift+Click+Drag or Simply by connecting a new wire the component keeps adding to outputs instead of starting over.

I haven't tried to add an OnPing events since there are other major problems. The mouse doesn't detect the new outputs on the canvas. I assume this happens because I can't override the Write and Read methods in the current GHPython component. I might be totally wrong though. For now I'm just using DataTree instead of creating new outputs.