There are a couple of ways of spotting that a bundle belongs to a scope.
Firstly, you can look at the manifest of the bundle. dm Server adds a Module-Scope header to the manifest of bundles which belong to a scope. The header contains the scope name. If the header is absent, the bundle is in the global scope.
Alternatively, if you're happy to use a dm Server internal service, the com.springsource.kernel.shim.scope.ScopeFactory service provides methods for getting the Scope of a Bundle and of a ServiceReference. Scope.getScopeName then lets you determine the name of the scope (null for the global scope).
Either way this means you can find the scope name of the extender and compare it to the scope name of another bundle. (The Scope implementation has an equals method, but I wouldn't recommend using it.)
Glyn Normington
SpringSource