# How do I forcefully import all functions/macros from my Package into my testing en

**URL:** <https://discourse.julialang.org/t/how-do-i-forcefully-import-all-functions-macros-from-my-package-into-my-testing-en/54529>\
**Category:** General Usage\
**Created:** [February 3, 2021, 1:04pm UTC](https://discourse.julialang.org/t/how-do-i-forcefully-import-all-functions-macros-from-my-package-into-my-testing-en/54529 "2021-02-03T13:04:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 3, 2021, 1:04pm UTC](https://discourse.julialang.org/t/how-do-i-forcefully-import-all-functions-macros-from-my-package-into-my-testing-en/54529/1 "2021-02-03T13:04:04Z")

</div>

How do I forcefully import all functions/macros from my Package into my testing environment. I currently have this monstrosity at the top of my `runtests.jl`

```julia
import AutoActuary: add_namespace, add_t_index, has_symbol, is_t_dottable, t_to_dot, ispreprocessable, remove_linenumbernodes, 
                    get_variables, t_linearcombinations, replace_variables, replace_variables, get_t_offsets, cycleclusters, 
                    add_name!, add_edge!, set_name!, get_name, get_id, has_name, create_a_dependancy_graph

```

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1612357400475100?thread_ts=1612357400.475100&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [February 3, 2021, 2:08pm UTC](https://discourse.julialang.org/t/how-do-i-forcefully-import-all-functions-macros-from-my-package-into-my-testing-en/54529/2 "2021-02-03T14:08:58Z")

</div>

![](https://global.discourse-cdn.com/julialang/original/3X/9/0/9095247c0ae2833e76d3287797c8b8e086bab178.png)

[Boston Gelwan](https://app.slack.com/team/U019K6Q9N15) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612357666475700?thread_ts=1612357400.475100&cid=C6A044SQH)

Wouldn’t `using AutoActuary` do the trick?

![](https://global.discourse-cdn.com/julialang/original/3X/9/0/9095247c0ae2833e76d3287797c8b8e086bab178.png)

[Boston Gelwan](https://app.slack.com/team/U019K6Q9N15) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612357696475900?thread_ts=1612357400.475100&cid=C6A044SQH)

Unless the issue is that they aren’t exported.

![](https://global.discourse-cdn.com/julialang/original/3X/5/a/5aad322befa8f6e2f9a162ed7c1cffdcfbbea85d.jpeg)

[Heetbeet](https://app.slack.com/team/U018FJVBXPD) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612357765476100?thread_ts=1612357400.475100&cid=C6A044SQH)

Yes, they aren’t exported, but I still want to test then without having to type `AutoActuary.foo` or import `foo` explicitely.

![](https://global.discourse-cdn.com/julialang/original/3X/9/0/9095247c0ae2833e76d3287797c8b8e086bab178.png)

[Boston Gelwan](https://app.slack.com/team/U019K6Q9N15) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612357926476300?thread_ts=1612357400.475100&cid=C6A044SQH)

I actually don’t think explicit imports are very monstruous at all. I’d be less comfortable with importing all the non-exported members of a module with some hack than just writing things out.But perhaps you and I differ in a sense of style. (edited)

![](https://global.discourse-cdn.com/julialang/original/3X/5/a/5aad322befa8f6e2f9a162ed7c1cffdcfbbea85d.jpeg)

[Heetbeet](https://app.slack.com/team/U018FJVBXPD) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612358064476600?thread_ts=1612357400.475100&cid=C6A044SQH)

I like explicit import and also likes to hide most of my internal functions, but in the case of testing, I would like to have something as close to “living in the same namespace” as possible.

![](https://global.discourse-cdn.com/julialang/original/3X/b/c/bc35889d84febf8bed58cce0f0d2790a284d8f35.jpeg)

[Mark Kittisopikul](https://app.slack.com/team/USU9FRPEU) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612358349476800?thread_ts=1612357400.475100&cid=C6A044SQH)

What happen if you implemented the tests within the module itself and then just ran them from runtests.jl ?

![](https://global.discourse-cdn.com/julialang/original/3X/f/1/f1ac3708aac807ab4e02c86ab05934ef81e420cc.png)

[Tommy Hofmann](https://app.slack.com/team/U85R3JJ8L) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612358389477000?thread_ts=1612357400.475100&cid=C6A044SQH)

for i in names(AutoActuary, all = true);try Main.eval(Meta.parse("import AutoActuary: " \* string(i))); catch e; end; end

![](https://global.discourse-cdn.com/julialang/original/3X/0/2/0282bfe6fc03d516e2d80c27119324622e2427a9.png)

[Fredrik Ekre](https://app.slack.com/team/U67SCG4HG) [1 hour ago](https://julialang.slack.com/archives/C6A044SQH/p1612358453477200?thread_ts=1612357400.475100&cid=C6A044SQH)

`import AutoActuary as aa` and then `aa.foo` etc?

![](https://global.discourse-cdn.com/julialang/original/3X/5/a/5aad322befa8f6e2f9a162ed7c1cffdcfbbea85d.jpeg)

[Heetbeet](https://app.slack.com/team/U018FJVBXPD) [43 minutes ago](https://julialang.slack.com/archives/C6A044SQH/p1612358647477400?thread_ts=1612357400.475100&cid=C6A044SQH)

[@Mark Kittisopikul](https://julialang.slack.com/team/USU9FRPEU), like having them in a function and then call that function from runtests.jl? I haven’t thought about that, that might work. But I think it’s nice having all the tests at the testy location.

![](https://global.discourse-cdn.com/julialang/original/3X/5/a/5aad322befa8f6e2f9a162ed7c1cffdcfbbea85d.jpeg)

[Heetbeet](https://app.slack.com/team/U018FJVBXPD) [32 minutes ago](https://julialang.slack.com/archives/C6A044SQH/p1612359326478000?thread_ts=1612357400.475100&cid=C6A044SQH)

I think I’m going to use this function, and then when I get closer to a “first release” remove it with the explicit names.

```julia
exportall() = begin
    for i in names(AutoActuary, all=true)
        if i in (:eval, :include)
            continue
        end
        try
            Main.eval(Meta.parse("import AutoActuary: $(i)"))
        catch e
        end
    end
end

```

![](https://global.discourse-cdn.com/julialang/original/3X/5/a/5aad322befa8f6e2f9a162ed7c1cffdcfbbea85d.jpeg)

[Heetbeet](https://app.slack.com/team/U018FJVBXPD) [\< 1 minute ago](https://julialang.slack.com/archives/C6A044SQH/p1612361268478400?thread_ts=1612357400.475100&cid=C6A044SQH)

Hmmm, but you end up losing all the VSCode clickiness action.
