title: Getting the path to access variables from other modules
body: <p>I'm new to OMNeT++ and I'm using Inet framework for a project.
  I want to access Mac module to get a variable while I'm in an Application module. I saw this in the omnet++ manual.</p>
  <pre><code>cModule *targetModule = getParentModule()-&gt;getSubmodule(&quot;foo&quot;);
  Foo *target = check_and_cast&lt;Foo *&gt;(targetModule);
  target-&gt;doSomething();
  </code></pre>
  <p>and this</p>
  <pre><code>cModule *app = module-&gt;getModuleByPath(&quot;.app[3]&quot;);  // note leading dot
  cModule *gen = module-&gt;getModuleByPath(&quot;.app[3].gen&quot;);
  </code></pre>
  <p>so I combined them and my representation of this came out like this :</p>
  <pre><code>cModule *macModule = cModule::getModuleByPath(&quot;TestNetwork.wlan[0].mac&quot;);
  updatedMac *target = check_and_cast&lt;updatedMac *&gt;(macModule);
  var = target-&gt;getVar(); 
  </code></pre>
  <p>the path is from the ini file.<br />
  I get this error :</p>
  <blockquote>
  <p>&lt;!&gt; check_and_cast(): Cannot cast nullptr to type 'inet::updatedMac *' -- in module (inet::ApplicationApp) TestNetwork.host[1].app[0] (id=85), at t=0.305s, event #250</p>
  </blockquote>
  <p>Did I get the path wrong? Then how can I write the path from applicationlayer module to linklayer module.</p>
  <p>I could really use the help.</p>