title: Does the dill python module handle importing modules when sys.path differs?
body: <p>I'm evaluating dill and I want to know if this scenario is handled.  I have a case where I successfully import a module in a python process.  Can I use dill to serialize and then load that module in a different process that has a different sys.path which doesn't include that module?  Right now I get import failures but maybe I'm doing something wrong.</p>
  
  <p>Here's an example.  I run this script where the foo.py module's path is in my sys.path:</p>
  
  <pre><code>% cat dill_dump.py 
  import dill
  import foo
  myFile = "./foo.pkl"
  fh = open(myFile, 'wb')
  dill.dump(foo, fh)
  </code></pre>
  
  <p>Now, I run this script where I do not have foo.py's directory in my PYTHONPATH:</p>
  
  <pre><code>% cat dill_load.py 
  import dill
  myFile = "./foo.pkl"
  fh = open(myFile, 'rb')
  foo = dill.load(fh)
  print foo
  </code></pre>
  
  <p>It fails with this stack trace:</p>
  
  <pre><code>Traceback (most recent call last):
    File "dill_load.py", line 4, in &lt;module&gt;
      foo = dill.load(fh)
    File "/home/b/lib/python/dill-0.2.4-py2.6.egg/dill/dill.py", line 199, in load
      obj = pik.load()
    File "/rel/lang/python/2.6.4-8/lib/python2.6/pickle.py", line 858, in load
      dispatch[key](self)
    File "/rel/lang/python/2.6.4-8/lib/python2.6/pickle.py", line 1133, in load_reduce
      value = func(*args)
    File "/home/b/lib/python/dill-0.2.4-py2.6.egg/dill/dill.py", line 678, in _import_module
      return __import__(import_name)
  ImportError: No module named foo
  </code></pre>
  
  <p>So, if I need to have the same python path between the two processes, then what's the point of serializing a python module?  Or in other words, is there any advantage to loading foo via dill over just having an "import foo" call?</p>