<?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 Re: Relative Path Reading Ambiguity in running nested run commands in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121801#M46554</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/169569"&gt;@data4life&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;For scenario 1, I tried running the same code, and I believe I found the issue. It's related to the %run command in NB1.&lt;/P&gt;&lt;P&gt;The line &lt;STRONG&gt;%run "./Folder2/NB2"&lt;/STRONG&gt; assumes that &lt;EM&gt;Folder2&lt;/EM&gt; is inside &lt;EM&gt;Folder1&lt;/EM&gt;, but that's not the case in your setup. So, when you run NB1 directly, it throws the same error you saw when running "main" — because NB1 can't locate &lt;EM&gt;Folder2&lt;/EM&gt; within its directory.&lt;/P&gt;&lt;P&gt;To fix this, try updating the line in NB1 to:&lt;BR /&gt;&lt;STRONG&gt;%run "../Folder2/NB2"&lt;/STRONG&gt;&lt;BR /&gt;The .. tells it to go up one directory level, allowing it to correctly find &lt;EM&gt;NB2&lt;/EM&gt; in &lt;EM&gt;Folder2&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Let me know if that helps!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="NB1.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17533iF28F37CF791D5B71/image-size/large?v=v2&amp;amp;px=999" role="button" title="NB1.png" alt="NB1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Jun 2025 08:04:40 GMT</pubDate>
    <dc:creator>eniwoke</dc:creator>
    <dc:date>2025-06-15T08:04:40Z</dc:date>
    <item>
      <title>Relative Path Reading Ambiguity in running nested run commands</title>
      <link>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121779#M46547</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I came across an unusual error while using the %run &amp;amp;&amp;nbsp;dbutils.notebook.run() functionalities of the notebook in tandem and the particular scenarios are listed below -&lt;/P&gt;&lt;P&gt;I have below directory structure(simplified) where all 3 notebooks are located - &lt;STRONG&gt;main, NB1 &amp;amp; NB2&lt;/STRONG&gt;. PFB the screenshots of all 3 notebooks for depicting the commands &amp;amp; error.&lt;/P&gt;&lt;P&gt;Test/&lt;BR /&gt;│── main&lt;BR /&gt;│── Folder1/&lt;BR /&gt;│ ├── NB1&lt;BR /&gt;│── Folder2/&lt;BR /&gt;│ ├── NB2&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="main.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17525iF7F4A4ADAD393252/image-size/large?v=v2&amp;amp;px=999" role="button" title="main.png" alt="main.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NB1.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17526i7D8C43BCBF0D71F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="NB1.png" alt="NB1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NB2.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17527iA45CC1F84A893466/image-size/large?v=v2&amp;amp;px=999" role="button" title="NB2.png" alt="NB2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Scenario 1: In the&amp;nbsp;&lt;STRONG&gt;main&lt;/STRONG&gt; notebook, I'm running &lt;STRONG&gt;%run "./Folder1/NB1" &lt;/STRONG&gt;and then&amp;nbsp;&lt;STRONG&gt;NB1&lt;/STRONG&gt; notebook further executes&amp;nbsp;&lt;STRONG&gt;%run "./Folder2/NB2". &lt;/STRONG&gt;Here the run fails in the main notebook while calling NB1 with below error(available in screenshot as well), even though the current working directory of both the %run are same&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Error: &lt;SPAN&gt;Notebook not found: Shared/Test/Folder1/Folder2/NB2.&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I&lt;/EM&gt;&lt;EM&gt;f the working directory is same for both %run then why its searching under&lt;/EM&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN&gt; '/Folder1/Folder2/NB2' &lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;rather it should have looked into&lt;/EM&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN&gt; '/Test/Folder2/NB2'&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; ?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Scenario 2:&amp;nbsp;In the&amp;nbsp;&lt;STRONG&gt;main&lt;/STRONG&gt; notebook, I'm running &lt;STRONG&gt;%run "./Folder1/NB1" &lt;/STRONG&gt;and but now&amp;nbsp;&lt;STRONG&gt;NB1&lt;/STRONG&gt; notebook executes &lt;STRONG&gt;dbutils.notebook.run&lt;/STRONG&gt;(&lt;STRONG&gt;"./Folder2/NB2",0) &lt;/STRONG&gt;and %run command cell is commented out. This time the main notebook completes successfully. Here also&amp;nbsp;the current working directory is same for both.&lt;/P&gt;&lt;P&gt;So, why is the relative path working differently in both scenarios, in spite the &lt;STRONG&gt;first call is via %run&lt;/STRONG&gt;, which essentially executes all the called notebook codes inline ?&lt;BR /&gt;Requesting all the contributors to opine if they are aware on this &amp;amp; to Databricks technical team as well to explain the same.&lt;/P&gt;&lt;P&gt;Thanks in advance!_/\_&lt;BR /&gt;#nestedruns&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jun 2025 11:57:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121779#M46547</guid>
      <dc:creator>data4life</dc:creator>
      <dc:date>2025-06-14T11:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Relative Path Reading Ambiguity in running nested run commands</title>
      <link>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121801#M46554</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/169569"&gt;@data4life&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;For scenario 1, I tried running the same code, and I believe I found the issue. It's related to the %run command in NB1.&lt;/P&gt;&lt;P&gt;The line &lt;STRONG&gt;%run "./Folder2/NB2"&lt;/STRONG&gt; assumes that &lt;EM&gt;Folder2&lt;/EM&gt; is inside &lt;EM&gt;Folder1&lt;/EM&gt;, but that's not the case in your setup. So, when you run NB1 directly, it throws the same error you saw when running "main" — because NB1 can't locate &lt;EM&gt;Folder2&lt;/EM&gt; within its directory.&lt;/P&gt;&lt;P&gt;To fix this, try updating the line in NB1 to:&lt;BR /&gt;&lt;STRONG&gt;%run "../Folder2/NB2"&lt;/STRONG&gt;&lt;BR /&gt;The .. tells it to go up one directory level, allowing it to correctly find &lt;EM&gt;NB2&lt;/EM&gt; in &lt;EM&gt;Folder2&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Let me know if that helps!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="NB1.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17533iF28F37CF791D5B71/image-size/large?v=v2&amp;amp;px=999" role="button" title="NB1.png" alt="NB1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 08:04:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121801#M46554</guid>
      <dc:creator>eniwoke</dc:creator>
      <dc:date>2025-06-15T08:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Relative Path Reading Ambiguity in running nested run commands</title>
      <link>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121816#M46560</link>
      <description>&lt;P&gt;Now, for Scenario 2: when you use dbutils.notebook.run in NB1 and call NB1 from main.py, it looks like the working directory is considered to be the one where main.py is located.&lt;/P&gt;&lt;P&gt;So, when NB1 executes the line &lt;STRONG&gt;dbutils.notebook.run("./Folder2/NB2", 0)&lt;/STRONG&gt;, it's effectively asking: "Where is &lt;EM&gt;Folder2&lt;/EM&gt; relative to the current working directory?" Since the current working directory is that of main.py, it won't be able to resolve the path correctly if &lt;EM&gt;Folder2&lt;/EM&gt; isn’t located relative to that directory.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 15:26:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121816#M46560</guid>
      <dc:creator>eniwoke</dc:creator>
      <dc:date>2025-06-15T15:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Relative Path Reading Ambiguity in running nested run commands</title>
      <link>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121818#M46562</link>
      <description>&lt;P&gt;I'm going to run an experiment in my workspace and let you know if I see the same thing.&amp;nbsp; I'm not sure if I have seen this, but also not sure if my use of relative pathing previously had notebooks in different directories as you have listed.&amp;nbsp; Generally, my main notebook is reference all other notebooks that are in the same directory.&amp;nbsp; I will report back what I see.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 16:29:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121818#M46562</guid>
      <dc:creator>jameshughes</dc:creator>
      <dc:date>2025-06-15T16:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Relative Path Reading Ambiguity in running nested run commands</title>
      <link>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121826#M46564</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/39807"&gt;@eniwoke&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for replying and trying this out.&amp;nbsp;&lt;BR /&gt;I understand that giving&amp;nbsp;&lt;STRONG&gt;%run "../Folder2/NB2"&amp;nbsp;&lt;/STRONG&gt;solves the issue, but the question is why is it so that I need to traverse one step back ?&lt;BR /&gt;As %run essentially executes the calling notebook codes inline from where it is being called, which in this case is the directory where main notebook is present. Similar to what you have pointed out that the directory for &lt;STRONG&gt;dbutils.notebook.run("./Folder2/NB2", 0)&amp;nbsp;&lt;/STRONG&gt;is same as that of main notebook, don't you think same should hold true for all the NB1 notebook codes, which can even comprise of another %run(as in my case) command ?&amp;nbsp;&lt;BR /&gt;PFB the screenshots(I updated the path to ensure a successful run) where you will see both the %run commands have same current working directory. So it should have recognized the path&amp;nbsp;&lt;STRONG&gt;%run "./Folder2/NB2"&lt;/STRONG&gt; as its executing directory is at the same level where Folder2 is present.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data4life_2-1750009172964.png" style="width: 787px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17540i01AEA68A05A93753/image-dimensions/787x368?v=v2" width="787" height="368" role="button" title="data4life_2-1750009172964.png" alt="data4life_2-1750009172964.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data4life_3-1750009194479.png" style="width: 839px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17541i9234D035F9847740/image-dimensions/839x195?v=v2" width="839" height="195" role="button" title="data4life_3-1750009194479.png" alt="data4life_3-1750009194479.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 17:40:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/relative-path-reading-ambiguity-in-running-nested-run-commands/m-p/121826#M46564</guid>
      <dc:creator>data4life</dc:creator>
      <dc:date>2025-06-15T17:40:25Z</dc:date>
    </item>
  </channel>
</rss>

