I have the following project structure
.
├── app
│ ├── main.py
│ ├── foo.py
│ └── bar.py
├── Dockerfile
├── input
│ ├── data
├── output
├── README.md
├── requirements.txt
└── rest_api.py
And my Dockerfile
FROM python:3.9-slim
# install require OS packages
# we use apt-get instead of apt because of the stable CI
RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential gcc git && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
pip3 install --upgrade pip
# define and create working directory
WORKDIR /usr/application
COPY /requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
COPY / .
ENV PYTHONUNBUFFERED=TRUE
CMD ["python3", "rest_api.py", "--environment-config-file", "/..."]
The file api_rest.py
calls submodules with from app.main import main as in
that seems to work. However, in main.py
, using the syntax from foo import *
raises ModuleNotFoundError
.
Being in the same folder, why is this happening and how can I resolve the issue?