List existing global variables, e.g. via varinfo()

varinfo just calls the names function and formats its output. It is probably easier to do what you want by calling names directly:

filter(n -> !isa(getfield(Main, n), Module), names(Main))

I submitted a PR to clarify the varinfo documentation: cross-reference names from varinfo docstring by stevengj · Pull Request #48779 · JuliaLang/julia · GitHub

1 Like