It is possible to do this by using using Code.require_file/2
E.g. consider this:
# foo.ex
defmodule Foo do
def bar, do: "Barrrr"
end
and then, in the same directory, put your script:
# main.exs
Code.require_file("foo.ex", __DIR__)
Foo.bar()
|> IO.puts()
You can tweak that to include some other 3rd party file that you manually put in your directory, but it isn't very idiomatic! You're unlikely to see something like the above ever (in fact, I just made it up). As previously noted, you're usually better off sticking to a Mix project (perhaps make a custom mix task).
Remember that Elixir is first and foremost a virtual machine (the Erlang VM), so it always brings along that "baggage". For quick one-off scripts where portability is the top priority, Elixir may not be the best choice. I might reach for Python for simple scripts (because rather than carrying its own baggage, it assumes your computer has all this stuff lying around), or Go (because it would compile any complexities into a single executable).