JuMP使用中出现的错误

运行下段程序时出现错误:

LoadError: UndefVarError: @defVar not defined
in expression starting at In[43]:37

Stacktrace:
[1] top-level scope
@ :0
[2] eval
@ ./boot.jl:360 [inlined]
[3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1094
求助,我看网上说增加global,我试了试还是不行

function T1(w_func,grid_b,β,u,z)
            # objective for each grid point
                for j in 1:1000
                b = grid_b[j]
                choice1 = Model(solver=GLPKSolverLP()) 
                @defVar(choice1, a >= 0)
                @setObjective(choice1, Max, u(a) + cp.β * (w_func.((b*(1+cp.r)+cp.w-a) .* cp.z[i])))
                results1 = solve(choice1)
                Tw1 = getObjectiveValue(choice1)
                c_choice1 = getValue(x)
                return Tw, σ
                end
            end