Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Thomas_R
Frequent Visitor

Import (function) notebook into own nootbook

Hi all

 

Is there any way to import one nootbook into another and at the same time have easy version control?

 

My purpos is to have a function-nootbook I can create a lot of usefull functions (and if you have some good scripts you want to share, feel free to also post a link to those 😉 ). I want to import that function-nootbook into all my other noethooks.

 

The only way I've found wich works, is to upload a Wheels notebook into "Custom Libraries". In this way, there are a step to make sure to upload the notebook each time, insted of just saving it in the workspace, and have the build-in version control

 

Hope you can help

/Thomas

9 REPLIES 9
12angrymentiger
Advocate III
Advocate III

We do this all the time.

 

We have a notebook called common_functions in which we can use in the parent notebook.

 

You will have to call the functions notebook this way in order to have the functions/variables in the session memory:     %run common_functions

 

If you run the child notebook this way, it will create a new session and you can't reference the child notebook functions in the parent notebook:  mssparkutils.notebook.run("notebook", params)

Hi,

I have a specific use case where I need a DataFrame in return after running the parent notebook. Is ther any suggested way to handle this type of scenarios.

Thomas_R
Frequent Visitor

Still waiting for you to get back to me for other possible soultuoins 🙂

Hi @Thomas_R 

 

Apologies for the delay in response.

The other alternative possible solution is Notebook Resources (Alternative approach) but the recommended possible solution is Custom Libraries with Wheels (Recommended Approach).

Notebook Resources:

Pros:

  • Simple setup: Just place the function notebook in a designated folder for import.
  • Function context: Functions stay close to the main notebook for easier reference.

Cons:

  • No explicit version control: Changes in the function notebook impact all notebooks using it.
  • Limited scope: Not ideal for functions used across different projects or workspaces.

Recommendation:

  • Choose Custom Libraries with Wheels if:
    • You need strict version control for your functions.
    • You have a large set of reusable functions.
    • You want to share functions across different projects or workspaces.
  • Choose Notebook Resources if:
    • You want a quick and easy setup for function import.
    • Your functions are tightly coupled with the main notebook.
    • You don't need explicit version control or extensive function reusability.

Ultimately, the best approach depends on your specific workflow and how you prioritize version control, modularity, and ease of use.

 

I hope this information helps. Please do let us know if you have any further questions.

 

Thanks

Hi @Thomas_R 


We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.
In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.


Thanks

v-cboorla-msft
Community Support
Community Support

Hi @Thomas_R 

 

Thanks for uisng Microsoft Fabric Community.

 

You're right, importing one notebook into another in Fabric with built-in version control isn't straightforward. One of the best approach is using Custom Libraries with Wheels.

Custom Libraries with Wheels:

  • Pros:
    • Works for importing functions across notebooks.
    • Provides version control through custom library versions.
  • Cons:
    • Requires manually uploading the updated notebook to create new versions.
    • Can be cumbersome if you update functions frequently.

Meanwhile we will reach out to the internal team to check for any other alternative approaches.

We will update you once we hear back from them.

 

Thanks

 

Following

Thanks for the clarification. If there are a better way layer on, please let me know 🙂

Hi @Thomas_R 


We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.
In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.


Thanks

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

MayFBCUpdateCarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.