If you have a lambda layer with a package named “X”, at the top of your function, write:
import sys
sys.path.append('/opt/X/')
AWS attaches the layer under the /opt directory. The above code adds that to the list of directories that the Python interpreter will search through when trying to find packages.