Ever since I understood and started making more use of modules my projects have improved drastically in terms of organisation and readability.
However, I invariably create lots of modules and multiple modules end up wanting to make use of each other. For example, in my latest project I have a “crew” module and a “ship” module. At some point they will each want to call a function in the other. That doesn’t work, of course. Two modules can’t require each other or else the space-time continuum is shattered.
You can try to avoid the modules needing anything from each other, but I’m finding that hard to do.
You can subordinate one to the other, allowing one to require the other but not vice versa. However, I’m now finding myself duplicating main module variables into the submodule (e.g. in the main module having something like: submodule.somevar = M.somevar). That feels messy.
How do you handle this? If you don’t have to, how did you prevent it from being an issue in the first place?