-module(hello). -export([hello/1]). hello(Name) -> % Spawn hello.py script and open communication channels Port = open_port({spawn, "python -u hello.py"}, [{packet, 1}, binary, use_stdio]), % Convert tuple {hello, Name} to external term format ReqData = term_to_binary({hello, Name}), % Send binary data to hello.py script port_command(Port, ReqData), % Wait for reply from hello.py script receive {Port, {data, RespData}} -> % Convert binary data to term {ok, binary_to_term(RespData)} after 5000 -> {error, timeout} end.