The message “xxx is not defined in Main” means that Julia does not see the function.
You need to compile it first. You didn’t provide a full Minimal working example (MWE) with your full code but try the following:
- Put the function in a file, e.g. myfuncs.jl
- in another file, write
include("myfuncs.jl"). Depending on where you put the file you might need to add the path, e.g. If it is in a subfolder “functions” it should beinclude("functions/myfuncs.jl") - Evaluate it/Send it to the REPL. You should see first a round arrow while julia compiles the function. If there is no error in your function you will see a tick mark on vs code on the line
Now julia should sees the function and you can call it.
This workflow is a bit dependent on how exactly you use VS code.
Consider using Revise if you want to change the function, then you use includet() instead of include()