Odeint function use with unit and dimensions

Description of problem

I am using python odeint function to solve differential equation. But it shows

Minimal code to reproduce problem

@check_units(V = volt,m = 1, h = 1, results= amp/meter2)
def I_Na(V,m,h):return g_Na * m
3 * h * (V - E_Na)

Potassium (K = element name)

@check_units(V = volt,n = 1, results= amp/meter2)
def I_K(V, n): return g_K * n
4 * (V - E_K)


@check_units(V = volt, results= amp/meter**2)
def I_L(V): return g_L * (V - E_L)
@check_units(V = volt,m = 1, n =1, h = 1, results= (volt/second, 1, 1,1))
def dALLdt(X, t):
V, m, h, n = X

#calculate membrane potential & activation variables
dVdt = (I_inj(t) - I_Na(V, m, h) - I_K(V, n) - I_L(V)) / Cm(V)
dmdt = alpha_m(V)*(1.0-m) - beta_m(V)*m
dhdt = alpha_h(V)*(1.0-h) - beta_h(V)*h
dndt = alpha_n(V)*(1.0-n) - beta_n(V)*n
return dVdt*mV/second, dmdt, dhdt, dndt

X = odeint(dALLdt, [-65.0*mV, 0.05, 0.6, 0.32], t)
V = X[:,0]*mV
m = X[:,1]
h = X[:,2]
n = X[:,3]

What you have aready tried

Expected output (if relevant)

Actual output (if relevant)

Full traceback of error (if relevant)

DimensionMismatchError: Function “I_Na” expected a quantitity with unit volt for argument “V” but got -0.065 (unit is 1).

Hi. Scipy’s odeint function is not aware of Brian’s unit system, and removes the units along the way so that when I_Na gets called, V is a dimensionless value. This is true for most library functions that are not part of the supported numpy functions.
But I am not sure I quite understand why you want to bypass the core of Brian (describing and solving differential equations) and replace it by Python function definitions and odeint – do you only want to use Brian’s unit system but not the rest of it?