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

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Example

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!


Got any Elixir Language Question?