start one script through another?


Even if I play with Blender since a year I think I’m on the beginning. While I’m playing with scripts a little I got a problem:

If I have a script in one text-object and another script or a part of a script in another text-object. Then I start the one script. How can this script call the other script. Or how can I get access to a part of this script (i.e. a “def …”).

What i’m thinking of is to change or append parts of a script while it is running.

Thank you (and sorry for my english)


Quidquid agis prudenter agas et respice finem

if you write the script as a function you can import the other text object
and call the function

ie the text object contains the function

def f(x):
return x*x

in the text object
import foo

print foo.f(5)

should print 25

importing is a cool way of doing things
but I’ve never figured out how (ie read in the doc)
Blender handles the namespace.

For example foo might hang about between
calls to so that if you ran
a second time having modified a buggy foo.f in the
text window then you might get the old foo.f.
A reload foo fixes this.

Hope this helps.