Dispatching query from one context to other

I have two contexts and one common Query class called “SharedQuery” which used between two contexts. I have QueryGateway.query(SharedQuery) in one context and QueryHandler for SharedQuery in another context. But the approach is not working.
Does this way of dispatching query from one context to other context work?

What is the recommended way of dispatching queries from a service using some context to a service running on other context in Axon.

Please suggest

Can someone please suggest me what is the recommended way of getting query response from another context in Axon?

Take a look at TargetContextResolver Multi-Context - Axon Reference Guide (axoniq.io)