# Why can't I use \`subtypes\` in a test?

**URL:** https://discourse.julialang.org/t/why-cant-i-use-subtypes-in-a-test/110235
**Category:** General Usage
**Tags:** package, testing
**Created:** [February 15, 2024, 5:21am UTC](https://discourse.julialang.org/t/why-cant-i-use-subtypes-in-a-test/110235 "2024-02-15T05:21:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)
#### Post date: [February 15, 2024, 5:21am UTC](https://discourse.julialang.org/t/why-cant-i-use-subtypes-in-a-test/110235/1 "2024-02-15T05:21:19Z")

</div>

I tried to use the `subtypes` function in a test, e.g.:

```julia
using Test

@test subtypes(Real) != 0

```

This works in the REPL, but in a package test this fails with:

```julia
UndefVarError: `subtypes` not defined

```

Can someone explain why and what to do about it?

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [February 15, 2024, 5:25am UTC](https://discourse.julialang.org/t/why-cant-i-use-subtypes-in-a-test/110235/2 "2024-02-15T05:25:53Z")

</div>

subtypes I believe is defined in interactiveutils which is loaded automatically by the repl, but needs to be loaded manually in scripts
