<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Why this notebook is returning an error only when called by another notebook? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151330#M53628</link>
    <description>&lt;P&gt;When I uncomment the last two lines of &lt;FONT color="#0000FF"&gt;Called_Notebook.py&lt;/FONT&gt; and run it manually by itself, it correctly returns the output as:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Status: SUCCESS&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Circle area: 50.26544&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But when I comment out the last two lines of&amp;nbsp;&lt;FONT color="#0000FF"&gt;Called_Notebook.py&lt;/FONT&gt;&amp;nbsp;and run it from the&amp;nbsp;&lt;FONT color="#993300"&gt;Caller_Notebook.py&lt;/FONT&gt;, it returns the output as "&lt;STRONG&gt;None&lt;/STRONG&gt;" from the &lt;EM&gt;Exception block&lt;/EM&gt; of the&amp;nbsp;&lt;EM&gt;area_of_circle(r)&lt;/EM&gt;&lt;SPAN&gt; function defined in the &lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;Called_Notebook.py&lt;/FONT&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;&lt;SPAN&gt;: Why the function is failing when called from&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;Caller_Notebook.py&lt;FONT color="#000000"&gt; ?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Called_Notebook.py&lt;/STRONG&gt;:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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}")&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Caller Notebook&lt;/STRONG&gt;:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    output = dbutils.notebook.run("./Called_Notebook.py",60,{"radius":"4"})
    print(output)
except Exception as e:
    print("Child notebook failed:", e)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Mar 2026 20:07:35 GMT</pubDate>
    <dc:creator>Saf4Databricks</dc:creator>
    <dc:date>2026-03-18T20:07:35Z</dc:date>
    <item>
      <title>Why this notebook is returning an error only when called by another notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151330#M53628</link>
      <description>&lt;P&gt;When I uncomment the last two lines of &lt;FONT color="#0000FF"&gt;Called_Notebook.py&lt;/FONT&gt; and run it manually by itself, it correctly returns the output as:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Status: SUCCESS&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Circle area: 50.26544&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But when I comment out the last two lines of&amp;nbsp;&lt;FONT color="#0000FF"&gt;Called_Notebook.py&lt;/FONT&gt;&amp;nbsp;and run it from the&amp;nbsp;&lt;FONT color="#993300"&gt;Caller_Notebook.py&lt;/FONT&gt;, it returns the output as "&lt;STRONG&gt;None&lt;/STRONG&gt;" from the &lt;EM&gt;Exception block&lt;/EM&gt; of the&amp;nbsp;&lt;EM&gt;area_of_circle(r)&lt;/EM&gt;&lt;SPAN&gt; function defined in the &lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;Called_Notebook.py&lt;/FONT&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;&lt;SPAN&gt;: Why the function is failing when called from&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;Caller_Notebook.py&lt;FONT color="#000000"&gt; ?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Called_Notebook.py&lt;/STRONG&gt;:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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}")&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Caller Notebook&lt;/STRONG&gt;:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    output = dbutils.notebook.run("./Called_Notebook.py",60,{"radius":"4"})
    print(output)
except Exception as e:
    print("Child notebook failed:", e)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2026 20:07:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151330#M53628</guid>
      <dc:creator>Saf4Databricks</dc:creator>
      <dc:date>2026-03-18T20:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why this notebook is returning an error only when called by another notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151345#M53630</link>
      <description>&lt;P&gt;dbutils.notebook.run() returns only what the called notebook passes to dbutils.notebook.exit().&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your called notebook in the end add this&amp;nbsp;&lt;/P&gt;&lt;P&gt;dbutils.notebook.exit(&lt;SPAN class=""&gt;f"{Value to return}"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2026 02:22:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151345#M53630</guid>
      <dc:creator>pradeep_singh</dc:creator>
      <dc:date>2026-03-19T02:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why this notebook is returning an error only when called by another notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151451#M53648</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/202980"&gt;@pradeep_singh&lt;/a&gt;, your suggestion worked. Thank you for sharing your knowledge. Worth noticing that not including&amp;nbsp;&lt;SPAN&gt;dbutils.notebook.exit(&lt;/SPAN&gt;&lt;SPAN class=""&gt;f"{Value to return}"&lt;/SPAN&gt;&lt;SPAN&gt;) raised the error in the exception block of the function inside the Called_Notebook - and that had confused me. Now, I know.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2026 18:20:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/why-this-notebook-is-returning-an-error-only-when-called-by/m-p/151451#M53648</guid>
      <dc:creator>Saf4Databricks</dc:creator>
      <dc:date>2026-03-19T18:20:03Z</dc:date>
    </item>
  </channel>
</rss>

