Ahmed,
There are several ways to do this.
A classic webforms example, which as been in DNN for years, is implementing the IModuleCommunicator interface of DotNetNuke.Entities.Modules.Communications. Here is an article that explains it.
A more modern approach would be to implement an observer pattern in javascript. For example, you could have a common js library that both modules reference. Module B could use a common function to register a callback function (event) and Module A could call a function that would therefore call the callback function from Module B. This is like a Pub/Sub architecture. Here is an example of how to do in jquery.