I have an azure function python app deployed which makes use of multiple python files from the codebase. Currently the structure is as follows :
├── HttpExample
│ ├── __init__.py
│ └── function.json
├── getting_started.md
├── host.json
├── local.settings.json
├── requirements.txt
└── shared_code
├── __init__.py
├── prep_backup.py
├── final_execution.py
├── final_helper.py
├── file_info.py
└── requirements.txt
In my HttpExample, inside the init.py, I call my function to do the work as follows:
import logging
import azure.functions as func
from shared_code import final_execution
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
final_execution.run_function() # fails here
if name:
return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
But the final_execution
makes use of import statements pointing to
from prep_backup import func1,func2
But the above block fails as :
Result: Failure Exception: ModuleNotFoundError: No module named 'prep_backup'. Please check the requirements.txt file for the missing module.
All the necessary public packages used are listed in the requeirement.txt.
Any suggestions to work around this?