Hello All,
I came across an unusual error while using the %run & dbutils.notebook.run() functionalities of the notebook in tandem and the particular scenarios are listed below -
I have below directory structure(simplified) where all 3 notebooks are located - main, NB1 & NB2. PFB the screenshots of all 3 notebooks for depicting the commands & error.
Test/
│── main
│── Folder1/
│ ├── NB1
│── Folder2/
│ ├── NB2



Scenario 1: In the main notebook, I'm running %run "./Folder1/NB1" and then NB1 notebook further executes %run "./Folder2/NB2". 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 -
Error: Notebook not found: Shared/Test/Folder1/Folder2/NB2.
If the working directory is same for both %run then why its searching under '/Folder1/Folder2/NB2' rather it should have looked into '/Test/Folder2/NB2' ?
Scenario 2: In the main notebook, I'm running %run "./Folder1/NB1" and but now NB1 notebook executes dbutils.notebook.run("./Folder2/NB2",0) and %run command cell is commented out. This time the main notebook completes successfully. Here also the current working directory is same for both.
So, why is the relative path working differently in both scenarios, in spite the first call is via %run, which essentially executes all the called notebook codes inline ?
Requesting all the contributors to opine if they are aware on this & to Databricks technical team as well to explain the same.
Thanks in advance!_/\_
#nestedruns