Reputation: 25
So I have a script that start a new process and return your PID, can I send message from another script by this PID from another python script? They scripts need be independent because are called by erlang port to python
This is the flow
Erlang call python script -> python script return PID of instantied process -> Erlang save this PID to use after -> Erlang can call another script in python to send message to first PID
So I think is it, sorry for my english.
Upvotes: 0
Views: 1200
Reputation: 906
Honestly didn't try by myself but think it would help you.
You may send direct messages from Erlang to Python via ErlPort using function python:cast/2
python:cast(Instance, Message) -> ok
before you need to start the python app and get the PID
{ok, Pid} = python:start(),
and then send message directly to the python module
{ok, Res} = python:call(Pid, 'py_module_name', func_in_py_module, [<<"Test_Message">>]),
you may check the detailed instructions here erlport python-cast or here python multiprocessing
Upvotes: 1