I am trying to invoke a custom operator from a blender addon, e.g. this one. However, when I call it from the command line I am getting the following error message:
>>> bpy.ops.node.liexport('INVOKE_DEFAULT')
Error: Traceback (most recent call last):
File "/ttsesm/blender/blender-2.83.2-linux64/2.83/scripts/addons/vi-suite06/vi_operators.py", line 607, in invoke
node = context.node
AttributeError: 'Context' object has no attribute 'node'
location: /ttsesm/blender/blender-2.83.2-linux64/2.83/scripts/modules/bpy/ops.py:199
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "/ttsesm/blender/blender-2.83.2-linux64/2.83/scripts/modules/bpy/ops.py", line 199, in call
ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Error: Traceback (most recent call last):
File "/ttsesm/blender/blender-2.83.2-linux64/2.83/scripts/addons/vi-suite06/vi_operators.py", line 607, in invoke
node = context.node
AttributeError: 'Context' object has no attribute 'node'
from my understanding the explanation is related to what @batFINGER is describing here. But then my question would be how to invoke the operator from the script.
The operator is related with the Export button that you can see in the node below:
and which node I created with the following commands:
ng = bpy.data.node_groups.new('NodeTree', 'ViN')
context_node = ng.nodes.new(type="No_Li_Con")

active_nodeandnode(IIRC) context member. Uselayout.context_pointer_set("node", node)to set it in the layout if not using from node editor. – batFINGER Oct 15 '20 at 16:45layout.context_pointer_set()is defined? Because I am gettingNameError: name 'layout' is not defined. – ttsesm Oct 16 '20 at 13:13layout = self.layoutIf it is used before an operatorlayout.operator(...)the operator will have that context member. eg may be in the 3d view or properties UI. – batFINGER Oct 16 '20 at 13:18