I have a flask app with the following file structure:
.env
app.py
config.py
/main_app
  __init__.py
  main.py
  /api
    api.py
    extra.py
    /models
      mod1.pkl
      mod2.pkl
In the api.py file, I have the following line:
from .extra import str2bool, load_model_pipelines, load_explainers, generate_shap_chart_data
When I call flask run from the console everything starts up fine.  However, when I go to run api.py directly I get the following error message:  ImportError: attempted relative import with no known parent package
If I change .extra to extra then everything works fine.
I find this puzzling. Why would it work one way when the app is run but a different way when run separately?
