Using Python 3.7 in Lambda, how to import a function run() from sample.py in lambda_function.py
Here's my code: File1 - lambda_function.py:
import sample.py
def lambda_handler(event, context):
sample.run()
return {
'statusCode': 200
}
File 2 - sample.py:
def run()
Print('success')
return {
'statusCode': 200
}
Error: { "errorMessage": "Unable to import module 'sample': No module named 'sample.py'; 'sample' is not a package", "errorType": "Runtime.ImportModuleError" }
Project structure in lambda:
