Here is an example illustrating (I think) all cases:
"""
A docstring for P
"""
module P
module C
# the function we're interested in
foo() = 42
## optionally, if you want to export foo:
# export foo
# use from inside the submodule itself
barC() = foo()
end
module M1
# from a sibling, using a relative path
using ..C
bar1() = C.foo() # or just foo() if it was exported
end
module M2
# since P is in your case the top-level module of a package,
# an absolute module path also works
using P.C
bar2() = C.foo() # or just foo() if it was exported
end
# use from the parent
barP() = C.foo()
## or, if foo was exported:
# using .C
# barP() = foo()
end
From outside the package (which includes other packages depending on P, the REPL when P is the active environment, or runtests.jl):
julia> using P
julia> P.C.foo()
42
In the REPL, docstrings for modules can be retrieved in the usual way:
help?> P
search: P Ptr pi pwd Pipe Pair put! prod pop! push! prod! print parse pairs pkgdir pathof parent promote println prevpow prevind pointer prepend! powermod position
A docstring for P
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
A docstring for P