Open jannikvlk opened 1 year ago
By default, each Jupyter Notebook instance runs independently and does not communicate or share data directly with other instances. Therefore, changes made in one notebook, such as executing code cells or modifying variables, won't be reflected in another notebook. This behavior is intentional to maintain separation and isolate the environments.
If you wish to share data or code execution between different notebooks, you can use Share variables using %store
or %run
magic commands: Jupyter Notebook provides magic commands that allow you to share variables between notebooks. For example, %store
lets you save variables to a file and access them from another notebook. %run
lets you execute code from another notebook and import its variables.
Interact with shared data sources: If you need to work with shared data, consider using external data sources such as databases, CSV files, or APIs that both notebooks can access. This way, both notebooks can read and modify the same data.
For example, sharing a variable between two Jupyter Notebook instances using the %store
magic command.
Notebook 1 (Sender):
In the first notebook, create a variable and store it using %store
.
# Notebook 1 (Sender)
shared_variable = "Hello, I am a shared variable!"
%store shared_variable
Notebook 2 (Receiver):
In the second notebook, we'll retrieve the shared variable using %store -r
.
# Notebook 2 (Receiver)
%store -r shared_variable
print(shared_variable)
I hope this answer will help you with your problem :')
when opening a Jupyter Notebook the second window doesn't move together with the first one.