cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use a variable to mention the path in the %run command

thushar
Contributor

To compile the Python scripts in Azure notebooks, we are using the magic command %run.

The first parameter for this command is the notebook path, is it possible to mention that path in a variable (we have to construct this path dynamically during the run) and use it?

myNotebookPath = '/Shared/myNotebook'

%run myNotebookPath

3 REPLIES 3

User16752242622
Valued Contributor

@Thushar R​ I don't think it is possible to pass the notebook path in a variable and run it with a %run.

I believe you can make use of notebook workflows. Notebook workflows are a complement to 

%run

https://docs.databricks.com/notebooks/notebook-workflows.html#notebook-workflows

Thanks, to my understanding and experience use of variable is not possible with %run, Thanks for your update

Hi @Thushar R​,

Just a friendly follow-up. Do you still need help or you were able to find a solution? please let us know

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group