Hello, good morning. I’m having an issue building a custom module, that I’ll use to automate some things for machine learning. There are functions in my module that cant find another modules present in the environtment:
using GLM, DataFrames, CSV;
using StatsModels: TableRegressionModel, StatisticalModel;
module SampleModule
export testfunction;
export IntPoint;
export r2;
struct IntPoint
x::Int64
y::Int64
end
"""
testfunction()
This function does nothing.
# This is a tile
## This is a subtitle
### This is a section
"""
function testfunction()
println("this is a simple function");
end
function r2(model)::Float64
beta0, beta1 = GLM.coef(model)
end
end
And when I will use it in the environment as:
julia> include("sample.jl")
julia> using .SampleModule
I got the following error:
julia> SampleModule.r2(model)
ERROR: UndefVarError: GLM not defined
Stacktrace:
[1] r2(model::TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, ProbitLink}, GLM.DensePredChol{Float64, LinearAlgebra.CholeskyPivoted{Float64, Matrix{Float64}, Vector{Int64}}}}, Matrix{Float64}})
@ Main.SampleModule C:\Users\jcbri\Documents\Workspace\julia\explore\sample.jl:28
[2] top-level scope
@ REPL[50]:1
What I’m missing?