I didn’t actually understood the code snippet (since it’s clearly plain javascript, not stimulus etc), but from what I could understand you want to communicate between sibling instances of a component.
Safest bet might be a parent component, connected to a parent DOM element of the two carousel nodes to bridge that communication.
Ohh I see now, one is inside the other recursively. I would implement a Stimulus component that can have a child target myself. You aren’t really gaining that much from the stimulus-components anyway.
It’s just a simple wrapper: