title: How should I access other modules within a module?
body: <p>I'm struggling with the "global" aspect of functions as it relates to modules.  Maybe someone here could tell me if this example would work, explain why  and then tell me the right way to do it.</p>
  
  <p>If I have two modules:</p>
  
  <p>f1.lua</p>
  
  <pre><code>local mod = T{}
  function mod.print_msg(msg)
      print(msg)
  end
  return mod
  </code></pre>
  
  <p>f2.lua</p>
  
  <pre><code>local mod = T{}
  function mod.print_hello()
      msgmod.print_msg('Hello')
  end
  return mod
  </code></pre>
  
  <p>and both are called in a "main" file</p>
  
  <pre><code>msgmod = assert(loadfile(file_path .. 'f1.lua'))()
  himod = assert(loadfile(file_path .. 'f2.lua'))()
  himod.print_hello()
  </code></pre>
  
  <p>Would print_hello still work if called from f2 or would I need to loadfile() f1.lua in f2?</p>