# BSON.load(filename,@\_\_MODULE\_\_) doesn't work inside a Test Module

**URL:** <https://discourse.julialang.org/t/bson-load-filename-module-doesnt-work-inside-a-test-module/100955>\
**Category:** General Usage\
**Tags:** bson\
**Created:** [June 29, 2023, 12:41am UTC](https://discourse.julialang.org/t/bson-load-filename-module-doesnt-work-inside-a-test-module/100955 "2023-06-29T00:41:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allan\_Baker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/allan_baker/32/42645_2.png) [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Post date:** [June 29, 2023, 12:41am UTC](https://discourse.julialang.org/t/bson-load-filename-module-doesnt-work-inside-a-test-module/100955/1 "2023-06-29T00:41:18Z")

</div>

I have a Module. Inside that module I have a BSON.@save and a BSON.load which takes care of saving a struct to and from disk.

The function that calls the BSON.load(filename,@ **MODULE** ) works fine if called by REPL/Main, or if called by ]pkg test if the runtests.jl function does not wrap the call to the load file inside its own module.

If the runstests.jl function is a module, then the struct loader fails because of ERROR: LoadError: ‘myModule’ UndefVarError

Any way to make this work?

Is this a common problem?

Best Regards,  
Allan
