Jaco-Ben Vosloo
Jaco-Ben Vosloo

Reputation: 3930

Setting constant value for an agent created in a source block

I have an agent that has a variable that I need to set as a constant

enter image description here

When adding this population to main all agents get generated without any issue.

But when adding a source block to create this agent and use it in a flow chart...

enter image description here

I get this error

enter image description here

It appears that the agents get created without access to the utils class...

How to have a constant variable that uses randomness in an agent created in a process flow block?

Upvotes: 1

Views: 102

Answers (1)

Benjamin
Benjamin

Reputation: 12793

Quick workaround: Just use a parameter instead. In its "on change" code, you can error() the model so it is never accidentally changed.

Now you have the same setup: a constant random value, unique for each agent instance but never changeable...

Upvotes: 1

Related Questions