How to import a package on startup in the Julia REPL, if available
julia
Solution
Try the following - bit of a hack until something better comes along in base Julia:
humanize_exists = isdir(Pkg.dir("Humanize"))
if humanize_exists && isinteractive(); using Humanize; end
Problem
I'd like to import a package anytime I start the REPL. Placing the following in `~/.juliarc.jl` is a start: ``` if isinteractive() using Humanize end ``` But if I start `julia` on a machine without this package, the REPL fails to start. So I tried the following: ``` if isinteractive() try using Humanize catch end end ``` but due to Julia's scoping rules, now `Humanize` is not even available in the global namespace. What is the best solution?