# Agents.jl Schedulers not defined error

**URL:** <https://discourse.julialang.org/t/agents-jl-schedulers-not-defined-error/62952>\
**Category:** New to Julia\
**Tags:** agents\
**Created:** [June 15, 2021, 2:54pm UTC](https://discourse.julialang.org/t/agents-jl-schedulers-not-defined-error/62952 "2021-06-15T14:54:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajith\_Vidanaarachch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rajith_vidanaarachch/32/25962_2.png) [@Rajith\_Vidanaarachch](https://discourse.julialang.org/u/Rajith_Vidanaarachch)\
**Post date:** [June 15, 2021, 2:54pm UTC](https://discourse.julialang.org/t/agents-jl-schedulers-not-defined-error/62952/1 "2021-06-15T14:54:43Z")

</div>

Hi,

I’m new to Agents.jl and Julia. I’ve been trying out the example from [https://juliadynamics.github.io/Agents.jl/stable/examples/schelling](https://juliadynamics.github.io/Agents.jl/stable/examples/schelling)

I get the error `UndefVarError: Schedulers not defined` when trying to run the following code.

```julia
using Agents

space = GridSpace((10, 10); periodic = false)

mutable struct SchellingAgent <: AbstractAgent
    id::Int # The identifier number of the agent
    pos::NTuple{2, Int} # The x, y location of the agent on a 2D grid
    mood::Bool # whether the agent is happy in its position. (true = happy)
    group::Int # The group of the agent, determines mood as it interacts with neighbors
end

properties = Dict(:min_to_be_happy => 3)

schelling = ABM(
    SchellingAgent,
    space;
    properties = properties,
    scheduler = Schedulers.by_property(:group),
)

```

I understand that Schedulers is a submodule inside the Agents package. What could be the reason that it is not working?

In pkg REPL I ran `test Agents` and this resulted in 5 failed tests as shown in [https://gist.github.com/rajithv/94a336fc0761d27b68f6a4197113b552](https://gist.github.com/rajithv/94a336fc0761d27b68f6a4197113b552).

I have uninstalled and reinstalled Julia, including removing the ~/.julia folder. But the error persists.

This code segment was working earlier. But unsure what I did to break it.

Any help would be much appreciated. I’m stuck now and not sure where to look for clues.

P.S.  
`Julia Version 1.6.1` and `Agents v4.0.1`

Thank you!

---

<div class="post-metadata">

**Author:** ![Libbum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libbum/32/3935_2.png) [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Post date:** [June 15, 2021, 3:43pm UTC](https://discourse.julialang.org/t/agents-jl-schedulers-not-defined-error/62952/2 "2021-06-15T15:43:22Z")

</div>

v4.0.1 is older, so it follows [this syntax](https://juliadynamics.github.io/Agents.jl/v4.0/examples/schelling/). You can either stick with v4 for now and learn most of what you need there, or upgrade to the most recent version of Agents and use the example file you linked above.

Let me know if you’re not sure how to upgrade your version.
