softtouch 9 Posted January 25 (edited) I am playing for the first time a little with Python4Delphi. When I have a python function, for example: def Parser(src:str) -> str: s = "Test " + src return s How do I call this from Delphi? I have this script in a stringlist, and can call PythonEngine1.ExecStrings(sl); But how do I set the parameter "src" before calling the script, and how do I get the "s" value back after the call? Edited January 25 by softtouch Share this post Link to post
pyscripter 689 Posted January 25 uses VarPyth; ... var Res, S: string; PythonEngine1.ExecStrings(sl); Res := MainModule.Parser(S); It would help to watch the tutorial videos and play with the Demos. 2 Share this post Link to post
softtouch 9 Posted January 25 (edited) 1 hour ago, pyscripter said: uses VarPyth; ... var Res, S: string; PythonEngine1.ExecStrings(sl); Res := MainModule.Parser(S); It would help to watch the tutorial videos and play with the Demos. Ok, that seems to work as expected. Thanks. Edited January 25 by softtouch Share this post Link to post