Hello everyone.
I have the following setup:
The 3 Lambda functions are standalone modules with their requirements pip installed in their folders.
The Flask app is a single app.py file.
Here is the directory structure.
Thanks
I think I just solved this myself...
I had to change the import to:
I have the following setup:
- 3 separate AWS Lambda functions, written in Python
- A small Flask app to test and run the lambda functions locally
The 3 Lambda functions are standalone modules with their requirements pip installed in their folders.
The Flask app is a single app.py file.
Here is the directory structure.
Output:└── MyProject
├── lambda1
..folders of libraries like lxml, requests etc...
├── handler.py
└── __init__.py
├── lambda2
..folders of libraries like lxml, requests etc...
├── handler.py
└── __init__.py
├── lambda3
..folders of libraries like lxml, requests etc...
├── handler.py
└── __init__.py
├── app.py
└── __init__.py
I am trying to import a function from each lambda file, to be used in the Flask app. I do it like so:from lambda1.handler import some_functionIn each lambda file I have an import statement like:
from some_file import something # This is inside the lambda folderWhenever I try to run the Flask app I get the following error:
Error: File "../lambda1/handler.py", line 7, in <module>
from some_file import something
ModuleNotFoundError: No module named 'some_file'
The question is: How can I import a function from a standalone, separate module I am working on?Thanks

I think I just solved this myself...
I had to change the import to:
from .some_file import something # This is inside the lambda folderI spent so much time trying different things! So simple at the end.