Seeking Assistance with Dynamic %run Command Path
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 05:25 AM
Hello Databricks Community Team,
I trust this message finds you well. I am currently facing an issue while attempting to utilize a dynamic path with the %run command to execute a notebook called from another folder. I have tested the following approaches using a conf_file variable:
- %run "/Users/.../blob_conf/{}".format(conf_file)
- %run f"/Users/.../blob_conf/{conf_file}"
Unfortunately, neither approach seems to be working as expected.
I would greatly appreciate your guidance and assistance in resolving this matter.
Thank you for your time and support.
Best regards,
Lotfi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 07:19 AM - edited 12-21-2023 07:20 AM
Hi,
If your config file is in the databricks file system then you should add dbfs:/
Ex: f"dbfs:/Users/.../blob_conf/{conf_file}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 08:29 AM
Hello Chari,
I appreciate your response, but I'd like to clarify that I prefer not to utilize the filestore of DBK for storing my configuration file. Instead, I aim to directly execute the notebook that houses my Python configuration.
Furthermore, employing 'dbutils.notebook.run()' function doesn't enable me to access and utilize the declared variables within the notebook.
Thank youuu for any help.

