Pass dir.path to a diferent script I'm building an addon which is a collection of scripts, and I have my UI coded as one of this scripts. On of my tools (script) requires a user input, in this case a folder path, but I don`t know how to pass it onto my export tool so it knows where to export the selected objects. Here is how it is written in my UI script, I just copied it:

# root for export
    scn = context.scene
    col = layout.column(align=True)
    col.prop(scn.my_tool, "path", text="")


It shows great in my Panel but I'm not sure how use the string it gives in another script.

Thanks

EDIT

Following @WhataMesh pointed out here is what I did. In my UI script I added a class with a string property and changed the layout to fit, also had to register and unregister the new class and the property.

class MySettings(PropertyGroup):

path = StringProperty(
    name="path",
    description="Path to Directory",
    default="",
    maxlen=1024,
    subtype='DIR_PATH'


def draw(self, context):
    layout = self.layout

# root for export
    scn = context.scene
    mytool = scn.my_tool
    col = layout.column(align=True)
    col.prop(mytool, "path", text="")

def register():
    bpy.utils.register_class(UI)
    bpy.utils.register_class(MySettings)
    bpy.types.Scene.my_tool = PointerProperty(type=MySettings)



def unregister():
    bpy.utils.unregister_class(UI)
    bpy.utils.unregister_class(MySettings)
    del bpy.types.Scene.my_tool
You can add properties to the scene that can be retrieved by all scripts. In the code you can find different 'variabletypes' (I think you can also make custom properties/variables yourself). To actually retrieve the value you will have to write bpy.data.scenes['Scene'].Annotation.my_bool

import bpy
from bpy.props import (StringProperty,
                       BoolProperty,
                       IntProperty,
                       FloatProperty,
                       EnumProperty,
                       PointerProperty,
                       )
from bpy.types import (Panel,
                       Operator,
                       PropertyGroup,
                       )

class Annotation(PropertyGroup):
    my_bool = BoolProperty(
        name="Enable or Disable",
        description="A bool property",
        default=False
    )

    my_int = IntProperty(
        name="Int Value",
        description="A integer property",
        default=23,
        min=10,
        max=100
    )

    my_float = FloatProperty(
        name="Float Value",
        description="A float property",
        default=23.7,
        min=0.01,
        max=30.0
    )

    my_string = StringProperty(
        name="User Input",
        description=":",
        default="",
        maxlen=1024,
    )

    my_enum = EnumProperty(
        name="Dropdown:",
        description="Apply Data to attribute.",
        items=[('OP1', "Option 1", ""),
               ('OP2', "Option 2", ""),
               ('OP3', "Option 3", ""),
               ]
    )

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.Annotation = PointerProperty(type=Annotation)


def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.Annotation