Posts

Showing posts from January 7, 2019

AWS Lambda: Unable to import module 'package/file': No module named 'util'

Image
0 I am struggling to get module importing to work in AWS lambda using Python 3. My file structure looks like this: package: stage1.py __init__.py util: helper1.py __init__.py helper1.py is a simple util class: def foo(): print("yes") Within stage1.py I have the following lines that cause Lambda to throw an error when it is starting: from util.helper1 import foo foo() Unable to import module 'package/stage1': No module named 'util' Both __init__.py files are empty. Sadly, I see that this works if I invoke the script locally. Frustrating is an understatement! python aws-lambda python-3.6 share | improve this question