Custom code widget interaction with neighbour widgets

Yes, there are several posts about the accordeon/collapse menu. But my problem is different and not addressed in these posts.
I would say, my issue is more about code-widgets in general and I wasn’t able to find any similar question or comment on this forum.
This is the reason why I’ve created this post.