# Julia -e "subtypes(Real)" fails

**URL:** https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991
**Category:** General Usage
**Created:** [December 17, 2020, 4:05pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991 "2020-12-17T16:05:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [December 17, 2020, 4:05pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/1 "2020-12-17T16:05:22Z")

</div>

As simple as that. Any file calling `subtypes` fails to be run as a script, or loaded with `julia -i`:

```julia
% julia -e "subtypes(Real)"

ERROR: UndefVarError: subtypes not defined
Stacktrace:
 [1] top-level scope at none:1
leandro@pitico:~/Drive/Work/JuliaPlay% ~/programs/julia/julia-
julia-1.4.2/ julia-1.5.1/ julia-1.5.2/ julia-1.5.3/ julia-d562a97f2b/ julia-vim/        
leandro@pitico:~/Drive/Work/JuliaPlay% ~/programs/julia/julia-d562a97f2b/bin/julia -e "subtypes(Real)"
ERROR: UndefVarError: subtypes not defined
Stacktrace:
 [1] top-level scope
   @ none:1

```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [December 17, 2020, 4:11pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/2 "2020-12-17T16:11:53Z")

</div>

```julia
julia> parentmodule(subtypes)
InteractiveUtils

```

which is only loaded in interactive sessions by default (see the manual).

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [December 17, 2020, 4:12pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/3 "2020-12-17T16:12:08Z")

</div>

`subtypes` is in the `InteractiveUtils` standard library, you need to load it first. This is done automatically only in the REPL

---

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [December 17, 2020, 4:23pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/4 "2020-12-17T16:23:19Z")

</div>

> [@Tamas\_Papp](#):
>
> (see the manual).

I know you are huge fan of the manual 🙂 but:

- Searching for `subtypes` leads to: [https://docs.julialang.org/en/v1/devdocs/reflection/#Subtypes](https://docs.julialang.org/en/v1/devdocs/reflection/#Subtypes)  
and there there is nothing mentioning that it is not loaded by default in scripts.

If one clicks on `subtypes` there, one arrives here:

- [Interactive Utilities · The Julia Language](https://docs.julialang.org/en/v1/stdlib/InteractiveUtils/#InteractiveUtils.subtypes:) nothing there either. Yet we see that it is part of `InteractiveUtils`.

We might guess that with that name that package is not loaded for scripts, but if we click in the entry at the menu, we arrive here: [Interactive Utilities · The Julia Language](https://docs.julialang.org/en/v1/stdlib/InteractiveUtils/) (and nothing again).

So it might be written somewhere, but I can assure you that _you_ are much faster than my docs search 🙂 . Thanks again.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [December 17, 2020, 4:30pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/5 "2020-12-17T16:30:36Z")

</div>

the error is clear, it’s not defined, so naturally one finds out where it is defined.

it is also written somewhere REPL loads interactiveutils

---

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [December 17, 2020, 4:44pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/6 "2020-12-17T16:44:22Z")

</div>

Oh yes, sure it is written somewhere. But searching for “REPL” (which I really would never think of facing this problem), leads to: [Julia v1.8 Release Notes · The Julia Language](https://docs.julialang.org/en/v1/NEWS/#REPL)

or to this (second entry): [Environment Variables · The Julia Language](https://docs.julialang.org/en/v1/manual/environment-variables/#REPL-formatting)

or to this (third entry): [Frequently Asked Questions · The Julia Language](https://docs.julialang.org/en/v1/manual/faq/#Sessions-and-the-REPL)

Even if I had “naturally found” where it is defined, I could not deduce if that was expected, or not.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [December 18, 2020, 1:57pm UTC](https://discourse.julialang.org/t/julia-e-subtypes-real-fails/51991/7 "2020-12-18T13:57:09Z")

</div>

> [@lmiq](#):
>
> So it might be written somewhere, but I can assure you that _you_ are much faster than my docs search 🙂 . Thanks again.

I am not sure _where_ it is written — maybe I just recalled this from somewhere. In any case, perfect opportunity to improve the docs, hence

> <https://github.com/JuliaLang/julia/pull/38937>
>
> I am not sure if it is documented elsewhere. Cf \[discussion\](https://discourse.j…ulialang.org/t/julia-e-subtypes-real-fails/51991/).
> 
> Closes #36578.
