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

Judicious use of import, using and export

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


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)
1 Like