How to deploy importing files in sub-directory

I’m a serverless newbie.

We are making new service using serverless framework with python + aws.
We have project directory like below.

root — common /
|-- regist /
|-- upgrade /

The file “” is imported in

The file “” includes below code to import file in sub-directory .
sys.path.insert(1, ‘…/common’)
from respond import respond

In this case, local test was finished successfully using pytest.
But after deploying on aws, test was failed due to “Unable import module…”.

I want to know how to deploy handler with sub-directory files.

You’re using 3 dots in your path. Isn’t that your issue?

1 Like

I solved it.

According this article, I must use PYTHONPATH instead of sys.