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

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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?