title: Wrapping a method using several source files
body: <p>I'm trying to understand how wrapping works in perl6. I'm using this code:</p>
  
  <p>First file (test.pl6):</p>
  
  <pre><code>use v6;
  use lib '.';
  
  use TestClass;
  
  my TestClass $t .= new;
  $t.wrapped(1, 7);
  </code></pre>
  
  <p>Second file (TestClass.pm6):</p>
  
  <pre><code>multi sub trait_mod:&lt;is&gt;(Routine:D \r, :$dummy!)
  {
      r.wrap(sub (|)
      {
          say 'Dummy';
          callsame;
      });
  }
  
  unit class TestClass;
  
  method wrapped($a, $b) is dummy
  {
      say "Wrapped ($a, $b)";
  }
  </code></pre>
  
  <p>When executing <strong>test.pl6</strong>, I get:</p>
  
  <pre><code>Cannot invoke this object (REPR: Null; VMNull)
    in sub  at TestClass.pm6 (TestClass) line 5
    in any enter at gen/moar/Metamodel.nqp line 3999
    in block &lt;unit&gt; at test.pl6 line 7
  </code></pre>
  
  <p>When all the code above is in the same file, it works and prints <strong>Dummy</strong> first and then <strong>Wrapped (1, 7)</strong>.</p>
  
  <p>What am I doing wrong?</p>