A startup.jl for packages

Suppose that you want to run some custom initialization code whenever a particular package is loaded. For example, perhaps you want to configure some display options for a plotting package.

The best solution I can think of is to define a function in startup.jl that uses @eval to load the package and run the initialization code. Is there a better way?

Requires.jl?

1 Like

Isn’t this what the module __init__ function is for? Or by “you” you mean a user, not the package author?

Yes, as the user.

You can use callbacks, but I would just do it in the startup.jl as you describe.