Explanations
The error message is actually pretty explicit:
Relatives import (using from . import module
, or from .module import something
) Only work if the module (ie the file) you are editing, and the module you are importing are in the same python package.
That means you need a __init__.py
file in that directory (for it to be considered a package).
I recommend you read the documentation on modules if you want to understand the import system better
Quick fixes
- either add a
__init__.py
to make your directory into a package
- or change your relative import to a normal import (ie. change
from . import inference
to import inference
.) — you may need to add the directory containing your files to sys.path
(documentation)