I'm running into an issue with how to properly declare imports for some modules that I've written.
Suppose the follow directory structure:
main_dir/
__init__.py
module_A
sub_dir/
__init__.py
module_B
module_C
So that modules B and C are both in the same subdirectory relative to module A.
Module B imports C. Module A sometimes imports B.
So, in Module B, using import module_C
works fines.
And in Module A, using import sub_dir.module_C
works fine.
However, in Module A, using import sub_dir.module_B
causes an ImportError no module named 'module_C'
because B imports C.
I'm assuming that I could change B to import sub_dir.module_C
but I don't want to do that because then it will break when I start directly in B rather than import B from A.
What's the correct way(s) to handle this sort of issue?