The Operator in the following code displays an info message in Blender’s top bar. If executed from the ‘Spacebar’ menu, it works. However, if called from another python Operator / script / console, the message is logged only in the terminal, not on the top bar.
How can an Operator be called so it displays its self.report message in the UI ?
Many thanks !
Link to the code: https://gist.github.com/charlesfleche/4e4c4a4617c07713ab99d4c5ffe9dd1e
import bpy
from bpy.types import Operator
from bpy.utils import register_class, unregister_class
bl_info = {
'name': "Test Operator.report",
}
class TestReport(Operator):
bl_idname = 'wm.test_report'
bl_label = 'Test Operator.report'
def execute(self, context):
print('TestReport.execute')
self.report({'INFO'}, 'Test Operator.report')
return {'FINISHED'}
def register():
register_class(TestReport)
def unregister():
unregister_class(TestReport)
if __name__ == '__main__':
register()
bpy.ops.wm.test_report()