Running a Julia script from MATLAB using system()

Hello,
I’m trying to run a Julia .jl script in a MATLAB program using the system command. The script runs perfectly fine, when I attempt to do so from the terminal, but I get a segmentation fault when I try to run it through the system command.

I have to import a custom project as part of this script, and I think this is where it throws the error. When I try to import other modules, such as MAT or LinearAlgebra it’s fine, but when I try to import MyPackage it throws the segmentation fault.

Any suggestions, or paths to explore would be appreciated.

Turns out I had to remove some paths from LD_LIBRARY_PATH, which Matlab was adding while running system, which interfered with Julia somehow(?). Works fine now