How to get the associated NPP instance from NPObject
In this method, an NPObject object of obj2 is passed to obj1. How can I get the NPP instance of obj2 from this NPObject in the method of obj1?
Short answer: you can't.
Longer answer that may actually help you do what you want to do, though in a different way:
You can't get that information in any "approved" way. You could probably find some way to pass the data across the barrier as a void* and dereference it or something, but that would be a very bad idea, IMO.
If you're trying to access data in another instance of your own plugin then just use a global std::map (or something similar) and have a NPObject method that gives you the key to access the correct value of the std::map. When I do this I just use a global/static int and increment it to give every instance a unique id, then I have a property or method on the NPObject that can be called from the other NPObject that returns that id. You take the id, look up the instance in the map, and off you go.
Many modern browsers actually wrap your NPObject in something else even when it's passed to another instance of your plugin so you can't get the original NPObject from the one you get, you can just make NPRuntime calls on it. We used to be able to do that with FireBreath, but it no longer works between different instances.