I believe you’re looking for l/1
.
You can execute the above in a remote
session to purge the “redefined” module and then reload the original from the .beam files.
❯ _build/prod/rel/test/bin/test remote
Erlang/OTP 25 [erts-13.1.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Interactive Elixir (1.14.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(test@mac)1> Test.hello
:world
iex(test@mac)2> defmodule Test do
...(test@mac)2> def hello do
...(test@mac)2> :edited
...(test@mac)2> end
...(test@mac)2> end
{:module, Test,
<<70, 79, 82, 49, 0, 0, 5, 40, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 176,
0, 0, 0, 18, 11, 69, 108, 105, 120, 105, 114, 46, 84, 101, 115, 116, 8, 95,
95, 105, 110, 102, 111, 95, 95, 10, 97, ...>>, {:hello, 0}}
iex(test@mac)3> Test.hello
:edited
iex(test@mac)4> l(Test)
{:module, Test}
iex(test@mac)5> Test.hello
:world
iex(test@mac)6>