0

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.

1 Answers1

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.

enter image description here

Then In Notebook1 reference the Notebook2 like below %run Notebook2.

When you execute it, you can access the variables from it.

enter image description here

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.

enter image description here

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