For example, if you make a function linked to the detector but then in order to give the user the UI you clone the detector into the widget, that function you made will be linked to the original detector instead of the new detector you created by cloning.
Same thing applies if you clone SwipeBar.
You have SwipeBar defined as
If you clone SwipeBar, then your reference SwipeBar is the original UI and the TextButton is being located inside the original UI instead of the new clone.
You can redefine your SwipeBar variable after you’ve cloned everything so you’re referencing the clone instead of the original.
(This is all assuming you are cloning the UI elements into the docking widget)