cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

"Importing" functions from other notebooks

MatthewHo
New Contributor

For the sake of organization, I would like to define a few functions in notebook A, and have notebook B have access to those functions in notebook A. Having everything in one notebook makes it look very cluttered. Is this possible?

4 REPLIES 4

RichIannone
New Contributor II

This is something I've been grappling with as well. My current 'solution' is to have separate notebooks with a function in each one (organized in a 'Functions' directory). Then I load the function into memory in another notebook by loading that notebook with single function.

It's not very elegant but at least the function called exists only in a single location.

I'd like to know if there is better way to do this. My current implementation is workable but far from the ideal.

Edit: this is the forum question/answer concerning the loading of a notebook within a notebook: https://forums.databricks.com/questions/154/can-i-run-one-notebook-from-another-notebook.html

it is too old thread but @Rich Iannone​  can we have the code i mean how you have done it

m96
New Contributor II

Old thread, but I wrote a module to do just this. Check it out: https://pypi.org/project/libify/

(Utilizes dbutils.notebook.run, so doesn't work with the Databricks community edition)

simone01
New Contributor II

<a href="https://managementassignmentshelp.com/risk-management-assignment-help.php ">Risk Management Assignment Help </a>

<a href="https://myassignmentmart.com/assignment/material-science-assignment-help.html "> Material Science assignment help </a>

<a href="https://matlabassignment.com/matlab-assignment-help.html ">Matlab Assignment Help in Australia </a>

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!