Description of problem
I’m trying to use @network_operation to change an external variable at every time step. However, per the Brian documentation : " The function being decorated should either have no arguments, or a single argument which will be called with the current time t
."
So the way I’m doing it is to pass the external variable as a global variable. Is there a better way to do this ? (since global variables are usually bad practice in Python)
Minimal code to reproduce problem
global var
var = 0
@network_operation(dt = 1*ms)
def f():
global var
var += 1
net = Network(f)
net.run(10*ms)
What you have aready tried
Tried to think about possible solutions but didn’t find any. Not sure if possible, just wondering. Thank you !