← Back to team overview

yade-users team mailing list archive

Re: [Question #659888]: 'PyRunner' module is unable to call self-defined function

 

Question #659888 on Yade changed:
https://answers.launchpad.net/yade/+question/659888

    Status: Needs information => Answered

Jérôme Duriez proposed the following answer:
Hello,

Regarding the PyRunner issue, a usual method is to just define
command='myPythonFunction()' in the PyRunner engine definition, with
myPythonFunction() encompassing the Python code you would like to run,
and being defined elsewhere in the script in the classical Python way.
Which gives:

O.engines =[...., PyRunner(command='myPythonFunction()')]

def myPythonFunction():
       # your "long" Python code here

Maybe this could be a "reason", a MWE would anyway help.

Jérôme

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.