Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Can't you have code outside your Azure Functions in python?

$
0
0

I am working on an Azure Function App where i have multiple Azure Functions defined as blueprints.

What i'm trying to do is create functions that the Azure Function blueprint can call inside the same file as the blueprint (refer to the example below).

BREAKS IN THE CLOUD:

import loggingimport azure.functions as funcbp = func.Blueprint()@bp.timer_trigger(    schedule="0 0 10 * * *",    arg_name="myTimer",    run_on_startup=False,    use_monitor=False,)def my_azure_function(myTimer: func.TimerRequest) -> None:    do_something()# This breaks the Function App in the cloud, not locally.def do_something():    logging.info("test log")

This works fine locally when i try and run it with the debugger, but when it is deployed to azure, the function does not show up under the Function App overview.

What is strange is removing the function and adding the code under the Azure Function blueprint itself does work when deployed (refer to the example below).

DOES NOT BREAK IN THE CLOUD:

import loggingimport azure.functions as funcbp = func.Blueprint()@bp.timer_trigger(    schedule="0 0 10 * * *",    arg_name="myTimer",    run_on_startup=False,    use_monitor=False,)def my_azure_function(myTimer: func.TimerRequest) -> None:    # This was done by a function before    logging.info("test log")

This is very annoying to me, as the Azure Function needs to do multiple things. Splitting the code up into multiple functions that can then be called by the Azure Function blueprint, is the best way to approach this i feel.

I have already done some research but was not able to find a solution to this issue. I have both looked through StackOverflow questions and read most of the Azure Function documentation.

Hope someone can tell me how to fix this or what i am doing wrong.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>