title: What is the best method to load a Jupyter notebook session into Spyder?
body: <p>Edit: See Spyder Notebook Plugin... <a href="https://github.com/spyder-ide/spyder-notebook" rel="noreferrer">https://github.com/spyder-ide/spyder-notebook</a></p>
  
  <hr>
  
  <p>I would like to load a Jupyter notebook into Spyder and activate the current Jupyter Python kernel in an Spyder Ipython console.  I was hoping this would allow me to use the Spyder editor, console and variable explorer whilst developing in Jupyter. Using the code below in Jupyter, I have been able to load up a converted notebook. In addition, I can open the current kernel in a new console manually. However, the variable explorer doesn't display variables from the connected console. </p>
  
  <p>I would like to:</p>
  
  <p>1) From Jupyter, automatically open the current Jupyter kernel in the Spyder IPython Console<br>
  2) Get the Spyder variable explorer to work with a connected kernel</p>
  
  <p>Any ideas? Does anyone have a better method than that listed below?</p>
  
  <hr>
  
  <h2>Open Jupyter notebook and kernel in Spyder:</h2>
  
  <h3>Get current notebook name</h3>
  
  <pre><code>%%javascript
  var nb = IPython.notebook;
  var kernel = IPython.notebook.kernel;
  var commandFileName = "theNotebook = " + "'"+ nb.notebook_path +"'";
  kernel.execute(commandFileName);
  </code></pre>
  
  <h3>Convert notebook to plain python script</h3>
  
  <pre><code>get_ipython().system('jupyter nbconvert --to script "' + theNotebook + '"')
  </code></pre>
  
  <h3>Open python script in Spyder</h3>
  
  <pre><code>get_ipython().system('spyder "' + theNotebook.replace('.ipynb', '.py') + '"')
  </code></pre>
  
  <h3>Get kernel json connection file</h3>
  
  <pre><code>import ipykernel
  print("Copy and paste this into Spyder diaolgue box:\nConsoles~'Connect to an existing kernel':\n")
  print(ipykernel.connect.get_connection_file())
  </code></pre>