--Directory structure: python/layer/function.py
--Import: from layer import layer1
function.py
def sum(x:int, y:int) -> int:
return x + y
lambda_function.py
import json
from layer import function
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': function.sum(1,2)
}
--Place it under the python /
directory and import the destination
――It's annoying that you have to coordinate so that the common system fits in when you zip it.
――It's a little difficult to debug just because Python says that there is no such module.
――It would be a little more kind if you output an error message from Lambda's point of view.