yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #08581
Re: [Question #239546]: Functions "not defined" through yade terminal, but defined through script ?
Question #239546 on Yade changed:
https://answers.launchpad.net/yade/+question/239546
Jan Stránský posted a new comment:
Hi Bruno,
> def printIt(): print O.iter
> globals()['printIt']=locals()['printIt'] #anyone knows a better way?
> O.engines=[PyRunner(command='printIt()',iterPeriod=1)]
> O.run(1)
>
you can directly use
globals()['printIt'] = printIt
without calling locals (slightly "better" way). Maybe it would be possible
to create some makeGlobal function for this purposes.
cheers
Jan
PS: When labeled engines are created, the variable is assigned as
__builtin__ module variable, accesible the from any scope
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.