Post #2551: How to use “External Script” in the poll field?

📋 Metadata

  • Author: Cirno
  • Date: 2019-07-26 10:52:37
  • Type: question
  • Quality Score: 7/10
  • Replies (1): post_02554

🏷️ Tags

pie-menu scripting intermediate unsolved

  • Python Scripting
  • Pie Menu Editor

💬 Content

How to use “External Script” in the poll field?
For example if I set poll to

return execute_script("scripts/cirno/mesh_selected_verts_poll.py")

and add to external script

import bmesh
ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
selected_verts = [v for v in bm.verts if v.select]
unselected = False if selected_verts else True
return unselected

Then I will get SyntaxError: 'return' outside fuction in console

What is the proper way to use script in the poll?


🔗 View on Blender Artists