You can use Code.ensure_compiled?/1, but there is a side effect: it will also attempt to load the module if it is not already, which may not be desired (depending on the use-case).