KeyError: 'The identifier "astrocyte_index_post" could not be resolved.'

Hi Marcel,
You are correct, I utilized the Brain documentation code. Here is the code that I was referring to; the equation is the same. I also maintained variables similar to the example because I wanted to verify if it works.

astro_eqs = '''
# ELLIPSIS BEGIN
# Fraction of activated astrocyte receptors:
dGamma_A/dt = O_N * Y_S * (1 - clip(Gamma_A,0,1)) -
              Omega_N*(1 + zeta * C/(C + K_KC)) * clip(Gamma_A,0,1) : 1
# Intracellular IP_3
dI/dt = J_beta + J_delta - J_3K - J_5P + J_coupling              : mmolar
J_beta = O_beta * Gamma_A                                        : mmolar/second
J_delta = O_delta/(1 + I/kappa_delta) * C**2/(C**2 + K_delta**2) : mmolar/second
J_3K = O_3K * C**4/(C**4 + K_D**4) * I/(I + K_3K)                : mmolar/second
J_5P = Omega_5P*I                                                : mmolar/second
# Diffusion between astrocytes:
J_coupling                                                       : mmolar/second

# Ca^2+-induced Ca^2+ release:
dC/dt = J_r + J_l - J_p                                   : mmolar
dh/dt = (h_inf - h)/tau_h                                 : 1
J_r = (Omega_C * m_inf**3 * h**3) * (C_T - (1 + rho_A)*C) : mmolar/second
J_l = Omega_L * (C_T - (1 + rho_A)*C)                     : mmolar/second
J_p = O_P * C**2/(C**2 + K_P**2)                          : mmolar/second
m_inf = I/(I + d_1) * C/(C + d_5)                         : 1
h_inf = Q_2/(Q_2 + C)                                     : 1
tau_h = 1/(O_2 * (Q_2 + C))                               : second
Q_2 = d_2 * (I + d_1)/(I + d_3)                           : mmolar

# Fraction of gliotransmitter resources available for release:
dx_A/dt = Omega_A * (1 - x_A) : 1
# gliotransmitter concentration in the extracellular space:
dG_A/dt = -Omega_e*G_A        : mmolar
# Neurotransmitter concentration in the extracellular space:
Y_S                           : mmolar
# ELLIPSIS END
# The astrocyte position in space
x : meter (constant)
y : meter (constant)
'''

glio_release = '''
G_A += rho_e * G_T * U_A * x_A
x_A -= U_A *  x_A
'''

astrocytes = NeuronGroup(N_a, astro_eqs, threshold='C>C_Theta', refractory='C>C_Theta',
                         # The gliotransmitter release happens when the threshold
                         # is crossed, it can be considered a "reset"
                         reset=glio_release,
                         method='rk4',
                         dt=1e-2*second)

# Add random initialization
astrocytes.C = 0.01*umolar #calcium released
astrocytes.h = 0.9 #gating variable
astrocytes.I = 0.01*umolar #IP3
astrocytes.x_A = 1.0 #fraction of astrocyte receptors activated


########################################################
#More Connections
#connections from synapses to astrocytes, as pathways to trigger astrocyte activation;
#connections from astrocytes to synapses as routes for gliotransmission and thereby modulation of synaptic release; 
#connections between astrocytes by GJCs.

ecs_astro_to_syn = Synapses(astrocytes, exc_syn,
                            'G_A_post = G_A_pre : mmolar (summed)')
ecs_astro_to_syn.connect('i == astrocyte_index_post')
ecs_syn_to_astro = Synapses(exc_syn, astrocytes,
                            'Y_S_post = Y_S_pre/N_incoming : mmolar (summed)')
ecs_syn_to_astro.connect('astrocyte_index_pre == j')

# Diffusion between astrocytes
astro_to_astro_eqs = '''
delta_I = I_post - I_pre            : mmolar
J_coupling_post = -(1 + tanh((abs(delta_I) - I_Theta)/omega_I))*
                  sign(delta_I)*F/2 : mmolar/second (summed)
'''
astro_to_astro = Synapses(astrocytes, astrocytes,
                          model=astro_to_astro_eqs)

# Connect to all astrocytes less than 70um away
# (about 4 connections per astrocyte)
# INCLUDE BEGIN
astro_to_astro.connect('i != j and '
                       'sqrt((x_pre-x_post)**2 +'
                       '     (y_pre-y_post)**2) < 70*um')

ast_mon = SpikeMonitor(astrocytes)


duration = 1*second

#Stimulation
run(duration, report ='text')