Passing functions as default arguments to functions in sibling modules

Hi Guys :slightly_smiling_face:

Is there a way to pass a function from a submodule (saved in a separate file) as a default argument to a sibling function? :thinking:
As an example, say that my module is structured as follows:

module Parent

import A: a 
import B: b 
import C: c 
import Child: foo

export bar, a, b, c, other_objects

# Do some stuff here
end

----------------------------

# Child.jl
module Child
export foo

function foo(MyFunc::Function=Parent.a, x::Int=1, y::Float64=1.234)
# Do some other stuff here
end

end

Ultimately, I want to be able to

  1. call submodule functions, e.g. Parent.a() / Parent.b() / …
  2. call Parent.foo() with default arguments,
  3. pass sibling module functions as arguments, e.g. Parent.foo(MyFunc=Parent.b)

I want to avoid importing A: a, B: b, ... within Child.jl if posssible.
When I try to use this format, Child fails to precompile when I load Parent:roll_eyes:

Any help would be greatly appreciated!
Thanks :+1:t3: :pray:t2:

I use import with the number of dots equal to the number of steps back in the hierarchy it needs to go minus one (i.e., .Module for a module defined inside the current one, ..Module for the parent module or a sibling module, and so on).

julia> module Parent
           const p = 1;
           module FirstChild; const fc = 2; end;
           module SecondChild
               import ..Parent
               f() = Parent.p; g() = Parent.FirstChild.fc
           end # SecondChild
       end # Parent

julia> Parent.SecondChild.f()
1

julia> Parent.SecondChild.g()
2

I am not aware this has any precompilation problems. Have you this installed as a package? If so maybe you are messing with precompilation because you are loading the package from withing the package, instead of loading a module by a path in the current module hierarchy.