- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 10:53 AM - edited 03-12-2026 10:56 AM
Hi @Ashwin_DSA,
Thank you for sharing your input. But the following response from a Databricks employee @aladda on a relevant question here seems to indicate that a variable in called notebook is available in calling notebook. And another reference shown below from an article seems to indicate the same. Am I missing something in these references below?
- %run is copying code from another notebook and executing it within the one its called from. All variables defined in the notebook being called are therefore visible to the caller notebook
- dbutils.notebook.run() is more around executing different notebooks in a workflow, an orchestration of sorts. Each notebook runs in an isolated spark session and passing parameters and return values is through a strictly defined interface.
Reference (last paragraph) from an article here:
The %run magic command functions differently compared to the dbutils.notebook.run() method. Unlike the latter, the %run command does not execute the child notebook independently; instead, it imports the child notebook into the existing parent Spark session. Consequently, any variables or functions defined in the child notebook become accessible in the parent notebook. This behavior is akin to the way Python imports work.