Executing RoboFont scripts with an other RoboFont script
I have al bunch of observers living in my *observers folders in the scripts folder of RoboFont.
I want to build a script which show all the observers in that folder as a checkBoxList.
Checking the box is execute that specific observer script.
But there is a problem:
import <hereMyObserver>I get errors like
CurrentFontis not defined...
If I run the observer script manually of course everything is fine.
If I try to
execfile(<hereMyObserver>.py)global vars (
eventis not defined) and imports (
fillis not defined) are unknown...
the cwd is my *observers folder!
Hope I made myself clear on this.
Is there something wrong with my thinking and the way python is (not) working? Please help :)
use in your "external" scripts
from robofab.world import CurrentFont
from mojo.roboFont import CurrentFont
Those global variables (
CurrentGlyph, …) are injected in the main script automatically.