# How to \`@ref\` a function from a different package?

**URL:** <https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682>\
**Category:** Tooling\
**Created:** [February 24, 2024, 2:48am UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682 "2024-02-24T02:48:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [February 24, 2024, 2:48am UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682/1 "2024-02-24T02:48:15Z")

</div>

From the package `FinEtoolsAcoustics` I want to reference a function defined in `FinEtools`. I thought this would work,

```julia
!!! note

    The bilinear-form function [`FinEtools.FEMMBaseModule.bilform_diffusion`](@ref) is used to compute
    the matrix.

```

but it appears Documenter dropped the specification of the location of this function

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/7/37034319a53ecf8eb2452fac7dc55e975a53c1de.png)  
Does anyone know what the correct incantation would be? I assume it isn’t levioSA?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [February 24, 2024, 11:24am UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682/2 "2024-02-24T11:24:31Z")

</div>

You’d have to make sure that the docstring for `FinEtools.FEMMBaseModule.bilform_diffusion` is included in your documentation (in a `@docs` block). If the `!!! note` is in a docstring itself, you’d also have to make sure there is a binding to `FinETools` in the module where that docstring is defined. What warning do you see when building the documentation?

Alternatively, you could also use an `@extref` link instead of `@ref`, via [GitHub - JuliaDocs/DocumenterInterLinks.jl: A plugin for Documenter.jl that enables linking between projects](https://github.com/JuliaDocs/DocumenterInterLinks.jl). That assumes you’re generating an inventory in `FinETools`, though, either with the upcoming release of `Documenter`, or by loading `DocumenterInterLinks` in the `docs/make.jl` file of that package.

> I assume it isn’t levioSA?

I don’t know what that means

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [February 24, 2024, 1:50pm UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682/3 "2024-02-24T13:50:53Z")

</div>

> [@goerz](#):
>
> don’t know what that means

Harry Potter reference perhaps

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [February 24, 2024, 1:58pm UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682/4 "2024-02-24T13:58:11Z")

</div>

Thank you. I was afraid that I was asking Documenter for too much. I will check out `@extref`!

It is an HP quote (scene from a classroom where the students are attempting to levitate a quill). It seems my assumption that by this time everyone has seen it is wrong… 😉

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [February 24, 2024, 3:41pm UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682/5 "2024-02-24T15:41:11Z")

</div>

> I will check out `@extref` !

To expand on my earlier comment, this requires the following steps:

1. The `FinETools` documentation needs to be rebuild and deployed with an `objects.inv` inventory file. If you wait a few more days until `Documenter v1.3.0` is released, and you upgrade the `FinETools` documentation build to use it, this will happen automatically. Until then, if you’re using `Documenter >= 1.0`, you can add `using DocumenterInterLinks` to the `docs/make.jl` file of `FinETools`. The `DocumenterInterLinks` contains a backport (actually, the prototype) for the same inventory-writing feature as the upcoming Documenter. If you’re currently using `Documenter < 1.0`, there’s also [GitHub - JuliaDocs/DocumenterInventoryWritingBackport.jl: Backport of inventory writing for Documenter 0.25-1.2](https://github.com/JuliaDocs/DocumenterInventoryWritingBackport.jl), but that’s currently in its 3-day waiting period for registration.

2. In the `docs/make.jl` file of `FinEtoolsAcoustics`, you have to add the following:

3. In the `FinEtoolsAcoustics` documentation, you then reference `[`FinEtools.FEMMBaseModule.bilform_diffusion`](@extref)`. That is, simply change `@ref` to `@extref`. See [Syntax · DocumenterInterLinks.jl](http://juliadocs.org/DocumenterInterLinks.jl/stable/syntax/) for more details (those might still change, but not in a breaking way).

Again, all of this will switch from “experimental” to “fully supported” (probably) before the end of the month, and going forward `DocumenterInterLinks` intends to be the full solution for “How to reference a function from a different package.”

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [June 8, 2024, 11:49am UTC](https://discourse.julialang.org/t/how-to-ref-a-function-from-a-different-package/110682/6 "2024-06-08T11:49:12Z")

</div>

Small update: [`DocumenterInterLinks` is now stable](https://discourse.julialang.org/t/ann-documenterinterlinks-v1-0/115362).
