title: AttributeError when reading a pickle file
body: <p>I get the following error when I'm reading my .pkl files on spyder (python 3.6.5):</p>
  
  <pre><code>IN: with open(file, "rb") as f:
         data = pickle.load(f)  
  
  Traceback (most recent call last):
  
   File "&lt;ipython-input-5-d9796b902b88&gt;", line 2, in &lt;module&gt;
     data = pickle.load(f)
  
  AttributeError: Can't get attribute 'Signal' on &lt;module '__main__' from 'C:\\Python36\\lib\\site-packages\\spyder\\utils\\ipython\\start_kernel.py'&gt;
  </code></pre>
  
  <p><strong>The context:</strong></p>
  
  <p>My program is made of one file: <code>program.py</code>
  In the program, a class <code>Signal</code> is defined as well as many functions. A simplified overview of the program is provided below:</p>
  
  <pre><code>import numpy as np
  import _pickle as pickle
  import os
  
  # The unique class
  class Signal:
      def __init__(self, fq, t0, tf):
          self.fq = fq
          self.t0 = t0
          self.tf = tf
          self.timeline = np.round(np.arange(t0, tf, 1/fq*1000), 3)
  
  # The functions
  def write_file(data, folder_path, file_name):
      with open(join(folder_path, file_name), "wb") as output:
          pickle.dump(data, output, -1)
  
  def read_file(folder_path, file_name):
      with open(join(folder_path, file_name), "rb") as input:
          data= pickle.load(input)
      return data
  
  def compute_data(# parameters):
      # do stuff
  </code></pre>
  
  <p>The function <code>compute_data</code> will return a list of tuples of the form:</p>
  
  <pre><code>data = [((Signal_1_1, Signal_1_2, ...), val 1), ((Signal_2_1, Signal_2_2, ...), val 2)...]
  </code></pre>
  
  <p>With, of course, the Signal_i_k being an object <code>Signal</code>. This list will be saved in .pkl format. Moreover, I'm doing a lot of iteration with different parameters for the <code>compute_data</code> functions. Many iterations will use past computed data as a starting point, and thus will read the corresponding and needed .pkl files.</p>
  
  <p>Finally, I'm using several computers at the same time, each of them saving the computed data on the local network. Thus each computer can access the data generated by the others and use it as a starting point.</p>
  
  <p><strong>Back to the error:</strong></p>
  
  <p>My main issue is that I never have this error when I start my programs by double-clicking the file or by the windows cmd or PowerShell. The program never crashes throwing this error and runs without apparent issues.</p>
  
  <p>However, <em>I can not read a .pkl file in spyder. Every time I try, the error is thrown.</em></p>
  
  <p>Any idea why I got this weird behavior?</p>
  
  <p>Thanks!</p>