title: Submodule intra-dependencies in Julia
body: <p>I'm trying to create a package with the following layout:</p>
  
  <pre><code>MyPkg
  ├── MyPkg.jl
  ├── Foo
  │   ├── Foo.jl
  │   └── another_file.jl
  └── Bar
      ├── Bar.jl
      └── yet_another_file.jl
  </code></pre>
  
  <p>My main package module looks something like this:</p>
  
  <pre><code># MyPkg.jl
  module Pkg
  
  include("./Foo/Foo.jl")
  using .Foo: FooStuffA, FooStuffB
  export FooStuffA, FooStuffB
  
  include("./Bar/Bar.jl")
  using .Bar: BarStruct, BarStuffC, BarStuffD
  export BarStruct, BarStuffC, BarStuffD
  
  end
  </code></pre>
  
  <p>The problem arises when <code>Foo</code> needs a type (specifically a <code>struct</code>) defined in <code>Bar</code> in some function arguments. I'm not sure how to import this type. I've tried seemingly all combinations of <code>include("../Bar/Bar.jl")</code>, <code>using Bar/.Bar/..Bar</code>, inside the <code>Foo</code> submodule, outside the submodule, etc.</p>
  
  <pre><code># Foo.jl
  module Foo
  
  # what am I missing here?
  
  function print_bar_struct(bar::BarStruct)
      @show bar
  end
  
  end
  </code></pre>
  
  <p>Any advice?</p>