@Po Chia Choon Thanks for reaching out. As per the screenshot you have specified
from ExeGet impart getDN..
but I don't see any python file starting with getDN in your screenshot.
Let' say if your file is CreateDNV.py and the folder is ExeGet then you need to use the below line
from ExeGet import x
Now let's say if you have the method define a test function inside your CreateDNV file you need to use below to call
x.test()
Sample example for your reference: https://stackoverflow.com/a/71999399/13796136
Created a Folder calcfunction
and added the add_number
function:
def add_number(n1,n2):
sum = n1 + n2;
return sum;
print("The sum of two number is",sum)
Calling this method from Azure Function Python Class:
import logging
import azure.functions as func
from calcfunction import calc
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
id = req.params.get('id')
if not id:
try:
req_body = req.get_json()
except ValueError:
pass
else:
id = req_body.get('id')
if id:
return func.HttpResponse(f"This is the user entered userId {id} and calc function value {calc.add_number(12,24)}")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a ID in the query string or in the request body for a personalized response.",
status_code=200
)
Folder Structure: