I have some code that I can't get to import correctly [on Linux]:
Files (every python file contains just a class by the same name and capitalization):
commandreader/
|-- CommandReader.py
|-- y/
|-- Switch.py
|-- Option.py
|-- __init__.py
|-- x/
|-- InputArg.py
|-- __init__.py
CommandReader.py's import:
from y import Switch
from y import Option
y/Switch.py's and y/Option.py's import:
from x import InputArg
y/__init__.py:
from .import x
from .Switch import Switch
from .Option import Option
y/x/__init__.py:
from .InputArg import InputArg
Error:
$ python3 ./CommandReader.py
Traceback (most recent call last):
File "CommandReader.py", line 12, in <module>
from y import Switch
File "/home/swatts/code/commandreader/y/__init__.py", line 2, in <module>
from .Switch import Switch
File "/home/swatts/code/commandreader/y/Switch.py", line 8, in <module>
from x import InputArg
ModuleNotFoundError: No module named 'x'
Edit: Along with my error, do I misunderstand how Python wants packages to work? Because that's the impression I'm under.