Apologies if I’m lacking google skills, but I’m unable to find a Julian equivalent of the following common python pattern:
if __name__ == "__main__":
run_my_main_func()
This construct prevents code being executed when import-ing in python.
I’m developing a few bespoke scripts in julia, with nearly all functionality separated into bite-sized functions. For debugging purposed, I’d like to include("thescript.jl") and run functions by hand, but I have main(ARGS[1], ARGS[2])-style code in there for CLI usage.
It looks as though that is specific to the REPL. While this solves my current issue, like the original stack overflow poster, I’d like to know if there is a way to tell if a file has been include()-ed or imported.