Is there a way to automatically run code when starting IEX?


I want to type iex -S mix and automatically run some code, like import MyModule as soon as IEX opens, to not need to write this to have my functions alongside Elixir Kernel functions.

Is this possible?

.iex.exs in first the current dir, and then $HOME is run on startup.


Oh, thank you very much, I had tried the .iex.exs file before but I had forgotten the dot in front so I thought it didn’t work for my case :sweat_smile:

1 Like