script addon Blender filepath
Invoke the filebrowser

If the filebrowser is invoked with only a directory property and no filepath it will only have choice of folder to export to.  Possibly more handy than having a path to set in the UI.

To call the operator from code with a directory use bpy.ops.object.colladaexport(directory="/tmp") and it wont invoke the filebrowser.

import bpy
import os

from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator

class ColladaExport(bpy.types.Operator):
    bl_idname = "object.colladaexport"
    bl_label = "Multi Collada export"
    filter_folder = BoolProperty(default=True) # only folders
    directory = StringProperty(subtype='DIR_PATH')

    def execute(self, context):

        selection = [o for o in context.selected_objects if o.type == 'MESH']
        scene = context.scene
        for ob in context.selected_objects:
            ob.select = False

        for obj in selection:
            scene.objects.active = obj
            obj.select = True
            filepath = os.path.join(self.directory, "%s.dae" % obj.name)
            '''
            bpy.ops.export_scene.collada(
                    filepath=filepath,
                    use_selection=True,
                    )
            '''
            print("collada export", filepath)
            obj.select = False

        for obj in selection:
            obj.select = True
        return {'FINISHED'}

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

# Only needed if you want to add into a dynamic menu
def menu_func_export(self, context):
    self.layout.operator(ColladaExport.bl_idname, text="Text Export Operator")

def register():
    bpy.utils.register_class(ColladaExport)
    bpy.types.INFO_MT_file_export.append(menu_func_export)

def unregister():
    bpy.utils.unregister_class(ColladaExport)
    bpy.types.INFO_MT_file_export.remove(menu_func_export)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.colladaexport('INVOKE_DEFAULT')


Note: just found out the collada exporter I have doesn't work, so I commented it out

As a stand alone property

If you wish to define a directory on say the scene object, use the 'DIR_PATH' sub-type of a StringProperty

bpy.types.Scene.directory = StringProperty(subtype='DIR_PATH`)


can display in a draw method via

self.layout.prop(context.scene, "directory")


which will include a browse button in layout to set folder using filebrowser, like that shown for setting the render output folder.



and can use this setting in operator above from draw method with

op = self.layout.operator("object.colladaexport")
op.directory = context.scene.directory


in which case could remove the invoke method in operator above to not invoke the file browser.

Since you are using if for an addon, saving to the addons user preferences would be a good option.  See this answer

EDIT  given the edit to your question, you need to register the scene property.

def register():
    bpy.utils.register_class(ColladaExport)
    bpy.utils.register_class(VrTools)
    bpy.types.Scene.directory = StringProperty(subtype='DIR_PATH')


def unregister():
    bpy.utils.unregister_class(ColladaExport)
    bpy.utils.register_class(VrTools)
    del(bpy.types.Scene.directory)