Page 1 of 1
Is it possible to call a function from a separate Python script even if the whole project is in Lua?
Posted: 14 Sep 2021, 23:36
by coder212
I use Lua in my project. But there is a task I need to be done, which I cannot find a way to code it Lua so I coded it with Python. Is it possible to call a function from a separate Python script using Lua?
Re: Is it possible to call a function from a separate Python script even if the whole project is in Lua?
Posted: 15 Sep 2021, 12:34
by coppelia
Hello,
normally the approach you would take is to write a
plugin that offers the missing functionality, via a new script command, e.g.
Code: Select all
local outArg1,outArg2,...=simMyPlugin.doSomeTask(inArg1,inArg2,...)
If you have an external application (i.e. not running in CoppeliaSim), then you have several ways to handle this via a
means of communication.
E.g. using the
ZeroMQ functionality (in the linked example, you would have the
requester in a CoppeliaSim script, and the
responder running in Python and handling requests from CoppeliaSim.
Cheers