I get this error when I try to run my script from the text editor. It is a simple exporter with some extra functions.

This code snippet is the culprit for the error:

def poll(cls, context):
    sfile = context.space_data
    operator = sfile.active_operator

    return operator.bl_idname == 'TEST_OT_advanced_export'

TEST_OT_advanced_export is my bl_idname. After running I am constantly getting the following error in my system console:

AttributeError: 'SpaceTextEditor' object has no attribute 'active_operator'

As far as I know, I need the poll function inside my class so that my defined custom attributes that appear in the File Browser do not appear when another function from Blender shows the File Browser. My script works perfectly fine, but it is spamming the error into the system console. How can I resolve that?


2 Answers 2


Removing the poll function out of the class solves the problem and keeps the functionality that the custom attributes do not appear in File Browser not called by this script.

But you have to keep the poll functions in all custom panels that you want to appear in only your File Browser.


The error message suggests that the context.space_data object, which is of type SpaceTextEditor, does not have an attribute called active_operator. The active_operator attribute is likely specific to a different type of space data, such as SpaceView3D, which is used for 3D modeling and animation.

It's likely that the poll method in this scenario is intended to be used with a different type of operator or space data, and is not suitable for use with SpaceTextEditor. You should check the documentation or the source code of the operator or addon that defines this method to see if it is intended to be used in this way.

  • $\begingroup$ The thing is I wrote the operator myself and was trying to fix the problem that my custom attributes that I defined in my class, that appear in my File Browser while using my export function were appearing in other File Browsers when Blender shows my one $\endgroup$
    – Lala_Ghost
    Commented Jan 18, 2023 at 8:58
  • $\begingroup$ add a check for sfile.type prior to assigning operator = sfile.active_operator if sfile.type is not a file browser return false. $\endgroup$
    – Ratt
    Commented Jan 18, 2023 at 9:04
  • $\begingroup$ the problem is that sfile.type is always of type VIEW_3D when run through favorites menu, a custom panel or search bar or of type TEXT EDITOR and never the file browser $\endgroup$
    – Lala_Ghost
    Commented Jan 18, 2023 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .