How to dynamically have the parent notebook call on a child notebook?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 10:10 AM
Hi! I would please like help on how to dynamically call one notebook from another in Databricks and have the parent notebook get the dataframe results from the child notebook. Some background info is that I have a main python notebook and multiple SQL notebooks. The python notebook needs to call on one of the SQL notebooks via a variable for the SQL notebook name and the SQL notebook should return a dataframe to the python notebook. So I need my python notebook to dynamically change the file path name of whichever SQL notebook that I want to call on and this is the part that I am stuck on. Here's what I tried:
- Using %run command doesn't allow variables in the filepath name so I'm unable to dynamically call on the SQL notebooks
- Using dbutils.notebook.run() allows variables in the filepath name but I don't know how to return the dataframe results from the SQL notebook to the parent python notebook
What would be the best way to accomplish what I'm looking for? Thank you so much for any input!