Elixir Language IEx Console Tips & Tricks Load a module or script into the IEx session


If you have an elixir file; a script or a module and want to load it into the current IEx session, you can use the c/1 method:

iex(1)> c "lib/utils.ex"
iex(2)> Utils.some_method

This will compile and load the module in IEx, and you'll be able to call all of it's public methods.

For scripts, it will immediately execute the contents of the script:

iex(3)> c "/path/to/my/script.exs"
Called from within the script!