Based on the answer here and the discussion on the forum here , there are several ways to do this:
Check if a function exists for the module
You can check if the function name is present as a key in Map.__info__(:functions)
module = Map
func = :keys
Keyword.has_key?(module.__info__(:functions), func)
# => true
Check if a function exists with a certain arity
To test with, aritywe can use Kernel.function_exported?/3:
Kernel.function_exported?(Map, :keys, 1) # => true
Kernel.function_exported?(Map, :keys, 2) # => false
Updated to use function from the Kernel module instead of the :erlang module