executing RoboFont scripts with an other RoboFont script

RoboFont Forums Help / General executing RoboFont scripts with an other RoboFont script

This topic contains 1 reply, has 2 voices, and was last updated by  frederik 6 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5872

    Thom
    Participant

    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

    #5873

    frederik
    Keymaster

    He Thom

    use in your “external” scripts

    from robofab.world import CurrentFont
    

    or

    from mojo.roboFont import CurrentFont
    

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

    good luck!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.