Group multiple functions in a subfolder?

ZZ 80 Reputation points
2025-01-13T14:43:59.66+00:00

I am learning azure functions and I have successfully built 3 functions. What I want to do is to place them in a subfolder within my project structure, like this:

project_root/
├── functions/
│   ├── func_a/
│   │   ├── __init__.py
│   │   └── function.json
│   ├── func_b/
│   │   ├── __init__.py
│   │   └── function.json
│   ├── func_c/
│   │   ├── __init__.py
│   │   └── function.json
├── host.json
├── local.settings.json
└── requirements.txt

But as soon as I move func_a, func_b and func_c insiude 'functions', they stop working. Running 'func start' within 'project_root' gives 'No job functions found. Try making your job classes and methods public.'. But if I move these three folders outside 'functions' and place them immediately within 'project_root', everything then works. Why? Is there a way to group them inside the subfolder?

Thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,540 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shireesha Eeraboina 2,140 Reputation points Microsoft External Staff
    2025-01-16T09:52:45.56+00:00

    Hi @ZZ,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    It sounds like you're encountering an issue with how Azure Functions identifies and loads function definitions from folders in your project structure. When you place your function folders (func_a, func_b, func_c) inside a subfolder like functions, Azure Functions might not be able to recognize them correctly because it expects them to be directly under the root or at the level where the function.json files and related function code are.

    • Ensure that the init.py files in each function directory contain the correct function definitions and that they are public and verify that the function.json files in each function directory are correctly configured.
    • Each function.json file should define the bindings and entry point for the function and ensure that your host.json file is correctly configured and placed in the root directory of your function app also the local.settings.json file should contain your local configuration settings and the requirements.txt file should list all the dependencies required for your functions.

    I hope this helps! Let me know if you have any further questions or need additional assistance.

     

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.