I have the following directory layout:
A/
A1.py
B/
B1.py
And B1.py is a script that relies on A1.py. My understanding is that if A has an __init__.py, then in B1.py I should be able to say:
from A import A1
However, no matter what I do I seem to get an ImportError: Module A not found. One of the things I've tried is doing
import sys
sys.path.append('path/to/A')
import A
But this doesn't seem to have helped either, and anyway it seems strange to me that such an ad hoc method is the solution.
I'm using python 3.5.1 Also, one other thing I guess I should double check - is it ok to have non-'.py' files within a module?
I'm at my wits' end about this - I've looked it up and it seems to me that this setup should work, but I suppose there's something I'm just not understanding. I'm sorry for making a more or less duplicate question to many that have been seen before, but it seems to me that I've followed the instructions given in other answers and it still isn't working.
As a side note - why is this not really easy in python? Why can't I just say something like
import ../A1
Any advice or comment is greatly appreciated.