Skip to content

Does Azure Function Python V2 supports multiple functions in a single Function Apps  #1395

@twsh15

Description

@twsh15

Hi all,

I need help setting up a project structure for my scenario - 3 different functions deployed in a single Azure Functions App. As far as I know, the only way to do so is to put all code logic of 3 functions as well as triggers in a single function_app.py, which is impractical from code maintainability and scalability perspectives. Something like the one below will work, but I don't think I'd go with it.

app = func.FunctionApp()

@app.schedule(schedule="0 0 2 * * *", arg_name="myTimer", run_on_startup=True,
              use_monitor=False) 
def FunctionA(myTimer: func.TimerRequest) -> None:
     do_something_for_functionA()
    if myTimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function executed.')

@app.schedule(schedule="0 0 2 * * *", arg_name="myTimer", run_on_startup=True,
              use_monitor=False) 
def FunctionB(myTimer: func.TimerRequest) -> None:
    do_something_for_functionB()
    if myTimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function executed.')

@app.schedule(schedule="0 0 2 * * *", arg_name="myTimer", run_on_startup=True,
              use_monitor=False) 
def FunctionC(myTimer: func.TimerRequest) -> None:
    do_something_for_functionC()
    if myTimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function executed.')

I need something more management and organized like below one (if possible):

.
└── Functions/
    ├── .venv
    ├── .python_packages
    ├── .vscode
    ├── .funcignore
    ├── .gitignore
    ├── function_app.py
    ├── function_a.py
    ├── function_b.py
    ├── function_c.py
    ├── host.json
    ├── local.settings.json
    └── requirements.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions