Can a Python script detect which Perspective view or binding it is running in?

Possibly a starting point here:

If you just log (not print!) a message, you should get useful MDC output indicating some information.

Technically you could retrieve that at runtime, via the static method on the MDC class:
org.slf4j.MDC.get("key")

As in:

from org.slf4j import MDC
component = MDC.get("component")
2 Likes