from __future__ import print_function import json import logging log = logging.getLogger() log.setLevel(logging.DEBUG) # this adds the component-level `lib` directory to the Python import path import sys, os # get this file's directory independent of where it's run from here = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(here, "<%= fnRootPath %>")) sys.path.append(os.path.join(here, "<%= fnRootPath %>vendored")) # import the shared library, now anything in component/lib/__init__.py can be # referenced as `lib.something` import lib def handler(event, context): log.debug("Received event {}".format(json.dumps(event))) return {}