Import Databricks notebooks as libraries/modules
Project description
Libify
(Does not work with Databricks Community)
Usage
After installing the package, add the following code snippets to the notebooks:
-
In the importee notebook (the notebook to be imported), add the following cell at the end of the notebook. Make sure that
dbutils.notebook.exit
is not used anywhere in the notebook and that the last cell contains exactly the following snippet and nothing else:import libify libify.exporter(globals())
-
In the importer notebook (the notebook that imports other notebooks), first import
libify
:import libify
and then use the following code to import the notebook of your choice:
mod1 = libify.importer(globals(), '/path/to/importee1') mod2 = libify.importer(globals(), '/path/to/importee2')
Everything defined in
importee1
andimportee2
would now be contained in the namespacesmod1
andmod2
respectively, and can be accessed using the dot notation, e.g.x = mod1.function_defined_in_importee1()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.