0

i am trying to use our custom python package in azure function but it is saying modulenotfounderror

strcuture:

import azure.functions as func
from pythonpackage.featureimpl import  feature as f

but it showed me error Exception: ModuleNotFoundError: No module named 'pythonpackage'

where should i put these python packages so that it can be imported into azure funtion

1 Answers1

0
  1. If 'pythonpackage'' is a public module that can be installed using pip, you should include it in the requirements.txt file.
    Microsoft Documentation Reference,

  2. If 'pythonpackage'' is a self-created module, then it is a python relative import query. You must include in a folder and ensure that the folder is accessible.

dir_path = os.path.dirname(os.path.realpath(__file__))  
sys.path.insert(0, dir_path)

import azure.functions as func  
from pythonpackage.featureimpl import feature as f  

For further information refer these Import custom modules in azure python-function and Import module into python azure-function.

RajkumarPalnati
  • 541
  • 2
  • 6