title: Env not modify when loading module in modulefile
body: <p>I would like to load a module into a modulefile (to resolve dependencies).</p>
  
  <p>MyModule:</p>
  
  <pre><code>#%Module########################################
  ##
  ##  Modulefile
  #
  proc ModulesHelp { } {
      puts stderr "Env for MyProg"
  }
  proc addPath {var val} {
      prepend-path $var $val
  }
  module load MyOtherModule 
  addPath   PATH   /opt/MyModule/bin
  </code></pre>
  
  <p>MyOtherModule:</p>
  
  <pre><code>#%Module########################################
  ##
  ##  Modulefile
  #
  proc ModulesHelp { } {
      puts stderr "Env for MyOtherProg"
  }
  proc addPath {var val} {
      prepend-path $var $val
  }
  addPath   PATH   /opt/MyOtherModule/bin
  </code></pre>
  
  <p>When I run <code>module load MyModule</code>, both modules seem to be loaded but environment is not right :</p>
  
  <pre><code>$module list
  Currently Loaded Modulefiles:
    1) MyModule   2) MyOtherModule
  $echo $PATH
  /opt/MyModule/bin:/usr/bin:/bin
  </code></pre>
  
  <p>If I add the line <code>foreach p [array names env] { set tmp $env($p) }</code> or at least <code>set tmp $env(PATH)</code> in the MyModule after the <code>module load MyOtherModule</code> line, the environment is correctly modified. It also work fine if I don't use my function <code>addPath</code> but I use the <code>prepend-path</code> command directly, which is a bit annoying because I would like to do more things in the <code>addPath</code> function of course.</p>
  
  <p>Anyone as an idea on what is going on and what I am missing ?</p>