reload_on = False #reload from external file or save all from internal import bpy area = bpy.context.area for text in bpy.data.texts: area.spaces[0].text = text if text.filepath != '' and reload_on == True: bpy.ops.text.reload() if text.filepath != '' and text.is_dirty: bpy.ops.text.save()