If you use a path in font(filePath)
then the path is relative to the current directory (which is not always the the directory of the python file)
DrawBot the app set the current directory to the .py file directory. When used as module this does not happen.
So either set the a correct current directory or get a absolute path from the .py file: os.path.join(os.path.basename(__file__), "font.otf")