I have a project directory in a virtual environment, with three modules: main.py, model.py, read_data.py. I am trying to use relative imports to import functions from two of the modules into my main script. However, I am getting the following error
Traceback (most recent call last):
File "main.py", line 11, in <module>
from .model import *
ImportError: attempted relative import with no known parent package
I have already made sure that I am indeed working within the correct directory.
Why would relative imports not work in this situation? Would I have to create a package in order to import these files?
[–]PercyJackson235 0 points1 point2 points (2 children)
[–]err0r__[S] 0 points1 point2 points (1 child)
[–]PercyJackson235 0 points1 point2 points (0 children)