Calling Elixir function from Python with pyrlang

Hello all,

I’ve recently been playing around with both Erlang and Elixir and wished to create a few apps for my Github with them, both of which required a small UI. For the Erlang project I managed to get a Java Swing program to call functions running on an Erlang server without any issues. For the Elixir project I’d like to use Python.

I came across ‘pyrlang’ and was able to run through a couple of examples of interacting with an Erlang server through Python, but I’m not finding much in the way of information regarding calling Elixir.

If anyone has any experience with pyrlang, can you tell me what I’d need to do to pass a couple of variables to an Elixir function, and retrieve the result?

# To start server: werl -name erl@ -setcookie COOKIE -env ERL_LIBS "C:\Program Files (x86)\Elixir\lib" -user Elixir.IEx.CLI -extra --no-halt
# To compile: c("library.ex")
# To test: Lib.add_numbers(3, 4)

defmodule Lib do
    def add_numbers(a, b) do
        a + b

Hello friend and welcome to the forum. :slight_smile:

Being in a similar boat, I’ve found the step-by-step articles below to be very helpful in devising a solution using ErlPort, an Elixir library:


Perhaps they can, at the very least, point you in the right direction? :slight_smile:

1 Like

In case anyone comes across this via searching for Pyrlang and Elixir examples:

The documentation, and code examples now cover elixir

There are 2 make commands for the python and elixir nodes Pyrlang/Makefile at master · Pyrlang/Pyrlang · GitHub

plus, there are Examples! — Pyrlang 1.0 documentation instructions and code
Pyrlang/examples/elixir at master · Pyrlang/Pyrlang · GitHub