How to deal with intermodule "communication"

Today, I have some clarifications to figure out, it is the design of whether it is feasible to use intermodule interaction, whether they should be direct or indirect(using a middleman). The question is mostly on the topic of architecture.

For context of what intermodule communication is: Let A and B be separate modules directly parenting to a main script. I have certain functionalities in B that A wants to use. In general, this looks ugly and causes a bunch of weird coupling between.

Commonly, I would have to require the module A from module B and fire the function. However, there has been cases where the design permits the main to handle both of these modules to solve the problem. What would be the best option out of these possible architectural choices? Would the faulty otherwise be the design of the module?