I'm puzzled that I could not find a question on this yet, since this seems like a fairly common situation. I might have overlooked it. Similar questions (like this one) exist, but they all appear to have different goals and constraints.
I'm writing code that is using another project as a git submodule. The (simplified) situation looks like this:
.
├── A.py
└── sub
    ├── B.py
    └── C.py
The contents of the files are as follows;
A.py
import sub.B
print(sub.B.x)
B.py
import C
x = C.y * 2
if __name__ == '__main__':
    print(x)
C.py
y = 7
When I try to execute A.py, it's telling me:
  File "/Users/Joost/poc/sub/B.py", line 1, in <module>
    import C
ImportError: No module named 'C'
Naturally, it works just fine when I modify B.py to actually get C from sub.C. However, as sub is a submodule from a third party, I cannot do that. Also, it would break submodule functionality.
What is the proper way to deal with this?
 
    