# Getting ERROR: LoadError: UndefVarError: Environment not defined when I try to use the modules I created

**URL:** <https://discourse.julialang.org/t/getting-error-loaderror-undefvarerror-environment-not-defined-when-i-try-to-use-the-modules-i-created/75559>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [February 1, 2022, 6:10am UTC](https://discourse.julialang.org/t/getting-error-loaderror-undefvarerror-environment-not-defined-when-i-try-to-use-the-modules-i-created/75559 "2022-02-01T06:10:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [February 1, 2022, 8:10am UTC](https://discourse.julialang.org/t/getting-error-loaderror-undefvarerror-environment-not-defined-when-i-try-to-use-the-modules-i-created/75559/2 "2022-02-01T08:10:12Z")

</div>

Judicious use of import, using and export

(the include makes no difference, it is just text subsitution)

```julia

module Environment
    export Env
    mutable struct Env
        distance_from_pasture::Real
        trips_milking_parlor::Integer
        topography::String
    end
end

using .Environment
export Env

module Cows
    import ..Env
    export Cow
    mutable struct Cow
        environment::Env
    end
end

using .Cows
export Cow

e = Env(1, 1, "")
c = Cow(e)

```

---

_[View the full topic](https://discourse.julialang.org/t/getting-error-loaderror-undefvarerror-environment-not-defined-when-i-try-to-use-the-modules-i-created/75559)._
