Folks, my prior experience is mainly in Matlab and I’m new to Julia, so forgive me if my question is basic.

I’ve written a likelihood function in Jupyter and want to maximize this function in JuMP. Since it’s 600 lines or so, I don’t want to type it directly in the REPL window/shell and don’t think it would work that way. I’ve saved it as a .jl file.

I find that functions that work fine on their own aren’t recognized when I try to maximize them in JuMP, at least if the function exists only inside a Jupyter file. To give a simple example, I type

include(“gammalikely.jl”)

data=[1;4;2;6;12;2]

M=Model(solver=IpoptSolver())

@variable(M,alpha>=0,start=0.0)

@variable(M,Beta>=0,start=0.0)

@NLobjective(M,Max,gammalikely2(alpha,data,Beta))

and get

“ERROR: Unrecognized function “gammalikely2” used in nonlinear expression”

Do you know how I can maximize a function if it’s defined in a file? Thanks in advance.