I'm trying to get some Python code to run on AWS Lambda. This is my file structure. I'm trying to run the lambda_handler function in the aws_lambda_function module.
The code in aws_lambda_function is:
import json
from server.server_code import process_request
def lambda_handler(event, context):
response = process_request(event)
return {
'statusCode': 200,
'body': json.dumps(response)
}
I am telling the lambda to look for the code to run here:
I have found that when I comment out line 2 from aws_lambda_function, I get the following error instead:

This suggests to me that it's having a hard time with how I'm trying to import the server_code module. I've tried each of the following:
from .server_code import process_request (this produces the same error about relative imports beyond top-level packages)
from server_code import process_request (this produces the error Unable to import module 'server.aws_lambda_function': No module named 'server_code')
I've read a lot of articles and Stack exchange threads about how to tackle this issue of relative imports in Python, but following their instructions haven't made a difference so far. (Note: I have been clicking the "Deploy" button each time I make a change.)
Any thoughts on how I can make it so that my handler can reference this function from the server_code.py file? It works fine when I run the code locally on my machine.

