Executing RoboFont scripts with an other RoboFont script

  • Hello!

    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:
    if i import <hereMyObserver> I get errors like CurrentFont is not defined...
    If I run the observer script manually of course everything is fine.

    If I try to execfile(<hereMyObserver>.py) global vars (event is not defined) and imports (fill is 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 :)

    Cheers, Thom

  • admin

    He Thom

    use in your "external" scripts

    from robofab.world import CurrentFont


    from mojo.roboFont import CurrentFont

    Those global variables (CurrentFont, CurrentGlyph, …) are injected in the main script automatically.

    good luck!

Log in to reply