Windows and doors can only exist inside of walls. They 'know' about the wall because the wall is their 'host'.
No other objects are wall-aware, and so the intelligence you hope for is not possible. You can create objects that are not windows and doors and save them as a window or door 'type' - but they would only be aware of the single wall that they would 'belong' to - it is impossible to query any information about adjacent walls.
Oops. Just realized that you posted this to the Developer forum. Is that intentional? Are you trying to program a custom add-on to manage what you are asking, or are you just asking how to work as a user in ArchiCAD?
Cheers,
Karl
One of the forum moderators
AC 28 USA and earlier • macOS Sonoma 14.7.1, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB