- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2026 08:20 PM - edited 03-11-2026 08:23 PM
Remarks: I though you can use %run command to make variables defined in one notebook available in another. The %run command executes the specified notebook inline within the current notebook's session, so all functions, variables, and DataFrames defined in the called notebook become accessible in the calling notebook.
PLEASE NOTE: Question is NOT about achieving the same using alternatives such as dbutils.notebook.exit() etc. It's rather what is the reason for this code is not working.
Notebook_A:
my_variable = "Hello from Notebook A"Notebook_B:
cell_1
%run "./Notebook_A"
cell_2
# Now you can use the variable defined in Notebook_A
print(my_variable)Output of cell_2:
my_variable
Expected output of cell_2:
Hello from Notebook_A
- Labels:
-
Delta Lake
-
Spark
-
Workflows