title: How to use script in interactive shell
body: <p>I wrote following python program</p>
  
  <pre><code>#! /usr/bin/python
  def checkIndex(key):
      if not isinstance(key, (int, long)): raise TypeError
      if key&lt;0: raise IndexError
  
  class ArithmeticSequence:
      def __init__(self, start=0, step=1):
          self.start = start      # Store the start value
          self.step = step        # Store the step value
          self.changed = {}       # No items have been modified
      def __getitem__(self, key):
          checkIndex(key)
          try: return self.changed[key]
          except KeyError:
              return self.start + key*self.step
      def __setitem__(self, key, value):
          checkIndex(key)
          self.changed[key] = value
  </code></pre>
  
  <p>the program is my.py when I do </p>
  
  <pre><code>chmod +x my.py
  python my.py
  </code></pre>
  
  <p>I am back to bash shell here after this step 
  I open a python shell</p>
  
  <pre><code>user@ubuntu:~/python/$ python
  Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  
  &gt;&gt;&gt; s=ArithmeticSequence(1,2)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  NameError: name 'ArithmeticSequence' is not defined
  </code></pre>
  
  <p>How do I give input to my program and run it because it was saved in vi</p>