- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2026 01:06 PM - edited 03-18-2026 01:07 PM
When I uncomment the last two lines of Called_Notebook.py and run it manually by itself, it correctly returns the output as:
Status: SUCCESS
Circle area: 50.26544
But when I comment out the last two lines of Called_Notebook.py and run it from the Caller_Notebook.py, it returns the output as "None" from the Exception block of the area_of_circle(r) function defined in the Called_Notebook.py. Question: Why the function is failing when called from Caller_Notebook.py ?
Called_Notebook.py:
dbutils.widgets.text("radius", "4")
r = float(dbutils.widgets.get("radius"))
status=""
try:
def area_of_circle(r):
return 3.14159 * r * r
circle_area = area_of_circle(r)
status = "SUCCESS"
except Exception as e:
circle_area = None
status = "ERROR"
error_message = str(e)
# print(f"Status: {status}")
# print(f"Circle area: {circle_area}")Caller Notebook:
try:
output = dbutils.notebook.run("./Called_Notebook.py",60,{"radius":"4"})
print(output)
except Exception as e:
print("Child notebook failed:", e)
- Labels:
-
Delta Lake
-
Spark
-
Workflows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2026 07:22 PM
dbutils.notebook.run() returns only what the called notebook passes to dbutils.notebook.exit().
If your called notebook in the end add this
dbutils.notebook.exit(f"{Value to return}")
Pradeep Singh - https://www.linkedin.com/in/dbxdev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2026 11:20 AM
Hi @pradeep_singh, your suggestion worked. Thank you for sharing your knowledge. Worth noticing that not including dbutils.notebook.exit(f"{Value to return}") raised the error in the exception block of the function inside the Called_Notebook - and that had confused me. Now, I know.