# Cross-referencing a function from a submodule defined later

**URL:** <https://discourse.julialang.org/t/cross-referencing-a-function-from-a-submodule-defined-later/80597>\
**Category:** General Usage\
**Tags:** documentation, documenter, module, cross-ref\
**Created:** [May 6, 2022, 10:05am UTC](https://discourse.julialang.org/t/cross-referencing-a-function-from-a-submodule-defined-later/80597 "2022-05-06T10:05:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![theogf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theogf/32/1987_2.png) [@theogf](https://discourse.julialang.org/u/theogf)\
**Post date:** [May 6, 2022, 10:05am UTC](https://discourse.julialang.org/t/cross-referencing-a-function-from-a-submodule-defined-later/80597/1 "2022-05-06T10:05:28Z")

</div>

I want to cross ref a function defined in a later submodule. Here is an example:

```julia
module A

"""
[`foo`](@ref)
"""
module B
end

module C
""" foo """
function foo end
end
end

```

[This SO answer](https://stackoverflow.com/questions/42384622/cross-referencing-functions-from-other-submodule-in-documenter-jl) suggests that `foo` should be imported in the `B` submodule, however one cannot import `C` in `B` since it’s defined later (and in my more complex usecase it’s not possible to change the order.  
So

```julia
module B
using ..C: foo
end

```

naturally does not work

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [May 8, 2022, 10:58pm UTC](https://discourse.julialang.org/t/cross-referencing-a-function-from-a-submodule-defined-later/80597/2 "2022-05-08T22:58:35Z")

</div>

Fully qualifying the binding as `A.C.foo` should work:

```julia
module A

"""
[`foo`](@ref A.C.foo)
"""
module B
# need to import A to get around the problem of C not being defined
using ..A

"""
[`foo`](@ref A.C.foo)
"""
function bar end

end

module C
""" foo """
function foo end
end
end

```
