I have a Python library that looks like this (contains packages):
|-- python_lib/
|-- plotting.py
|-- verification.py
|-- io.py
|
|-- ensemble/
| -- plotting.py
| -- verification.py
However, I am having problems with ambiguous module imports. In ensemble.plotting.py
I want to import the verification.py
module from the top level (python_lib
):
# ensemble/plotting.py
import verification.obs as verobs
However, I get an import error as this tries to import the verification.py
module from the ensemble directory, rather than the top level of the library.
I thought that the "abslute imports" feature would solve this:
from ..verification import obs
but I get this error:
ValueError: Attempted relative import beyond toplevel package
How do I target python_lib/verification.py
as an import from python_lib/ensemble/*.py
without trying to import the local package version?
I am using Python version 2.7.