5
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

updated at

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

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()

Register as a new user and use Qiita more conveniently

  1. You can follow users and tags
  2. you can stock useful information
  3. You can make editorial suggestions for articles
What you can do with signing up
5
Help us understand the problem. What are the problem?