I have one notebook1 in synapse ws with python code that contains some variable. I have created another notebook2 and I'd like to use the variables from notebook1. I tried to import as a package, but it didn't work. Has any one done that in the past.
Asked
Active
Viewed 97 times
1 Answers
0
You can get the variables from another Notebook by referencing using %run
in present Notebook.
Example:
This is my Notebook2 in which I have defined two variables.
Then In Notebook1 reference the Notebook2
like below %run Notebook2
.
When you execute it, you can access the variables from it.
Note: Make sure you publish the Calling Notebook(Notebook2) to access the recent changes in that Notebook.
and don't execute any code in %run
cell otherwise it will error like below.

Rakesh Govindula
- 5,257
- 1
- 2
- 11