# How to import self made modules on lambda

**URL:** https://forum.serverless.com/t/how-to-import-self-made-modules-on-lambda/12346
**Category:** Serverless Framework
**Tags:** aws, lambda
**Created:** [August 21, 2020, 7:30am UTC](https://forum.serverless.com/t/how-to-import-self-made-modules-on-lambda/12346 "2020-08-21T07:30:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![irineul](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@irineul](https://forum.serverless.com/u/irineul)
#### Post date: [August 21, 2020, 7:30am UTC](https://forum.serverless.com/t/how-to-import-self-made-modules-on-lambda/12346/1 "2020-08-21T07:30:13Z")

</div>

Hello,

I want to create functions that will be used by many other lambdas.  
So, my project structure is like that:

```auto
backend
└── libs
    ├── test
            ├── helper.py
    └── requirements.txt
└── services
    ├── test-api
            ├── .serverless
            ├── node_modules
            ├── app.py
            ├── package.json
            ├── package-lock.json
            ├── requirements.txt
            ├── serverless.yml
└── requirements.txt
└── serverless.common.yml

```

I want to share the code inside `libs/serde/helper` on `test-`api, so I installed `serverless-python-requirements`  
And, I added to the `serverless.yml` of `test-api`:

```auto
plugins:
  - serverless-python-requirements
.....

```

But, when running my lambda `test-api` I receive the error:  
`ModuleNotFoundError: No module named 'libs'`

So, how can I work with functions that are shared by multiple lambdas? What am I doing wrong?

---

<div class="post-metadata">

### Author: ![BryschG](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bryschg/32/4516_2.png) [@BryschG](https://forum.serverless.com/u/BryschG)
#### Post date: [August 26, 2020, 8:11pm UTC](https://forum.serverless.com/t/how-to-import-self-made-modules-on-lambda/12346/2 "2020-08-26T20:11:07Z")

</div>

I was facing the same problem today and finally i solved it but i’m not sure if i did it to complicated.

1. i have a simple serverless project with 3 lambda’s each package as a module “individually”
2. for the functions i want to reuse i built a python package (egg)
3. then i created a lambda layer for the self-made package
4. then i could import the package/modules in the lambda function

before i packed each lambda as a module i could import the functions from an “upper” folder, but after modularize them not anymore.

I did my steps along this doc

> **[How to import a python module in multiple lambda function?](https://www.edureka.co/community/41981/how-to-import-a-python-module-in-multiple-lambda-function)**
>
> I have a couple of AWS Lambda functions. I have my functions in a separate file called ... t have to change anything in my Lambda functions.

  
and also used this sample project [https://github.com/bryantbiggs/repro-serverless-requirements/blob/master/sdk/setup.py](https://github.com/bryantbiggs/repro-serverless-requirements/blob/master/sdk/setup.py)

I cannot provide you my project like it is now, but if you need it as a whole i can strip out some stuff and then provide it to you; but maybe those parts already help you.
