I have a popup that can allow the user the set a value. I can see that the value is getting set correctly as it reports it to the console. However after the function that calls the Operator completes how is it possible to access values that we set inside the Operator class?

class OpenBrowser(bpy.types.Operator):
    bl_idname = "open.browser"
    bl_label = "Select Path"
    bl_options = {"REGISTER", "UNDO"}

    directory = StringProperty(subtype="DIR_PATH") 
    cancel_search = BoolProperty(
        name="Cancel Search",
        description="If no further images are to be found",

    def execute(self, context):
        display = "dirpath=" + self.directory  
        return {'FINISHED'}

    def invoke(self, context, event): 
        wm = context.window_manager
        return {'RUNNING_MODAL'}  


How do I access the value that was set for directory following the the completion of the last function call?


Best I can think of is:

Register new property:

bpy.types.Scene.directory = bpy.props.StringProperty()

and copy contents of Your self.directory to this property while executing (in execute method):

context.scene.directory = self.directory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.