Hi,
I am coding a blender project and the code I am writing is just too much to be contained in one blender text script. I have looked at Blender.Run(script) it is a nice way to organize the script in different pieces. Unfortunately this is not what I am looking for.
My question is: Assume that I have two scripts in blender text window(2 files called X and Y) is it possible to call a method that exist in script Y from script X.
for example: script Y has a method called printThis(), and script X wants to call that method is there a way to have it called from script X as in Y.printThis() ???
I think that if you want to call procs from a text file called “scripty” in the same .blend file, you should rename it to “scripty.py” and only then you can use:
from scripty import *
............
............
scripty.printThis()
............
scripty.printThat()
............
On the other hand, if you want to include the file ~/foo/bar.py, but you don’t want to open it in Blender’s text editor (e.g. because you have a big project with 200 files), you could try this:
import bpy, sys, os
path = os.path.expanduser('~/foo')
sys.path.append(path)
import bar
bar.run()
Beware however that Blender will not update bar.py if you change it in an external editor.