8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS Lambdaで他のディレクトリのpythonのclassをimportする

Last updated at Posted at 2018-03-02

AWS Lambdaでpython importする

my_prj
|
├── src
|    ├── lambda
|    |     └── lambda_function.py
|    ├── api
|    |     └── api.py
|

他のディレクトリのpythonのclassをimportする
lambda_function.pyか らapi.pyをimport するためのコード

import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
from api.util_api import UtilApi


def lambda_handler(event, context):
    util_api = UtilApi()
    util_api.create_data()
8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?