Storing Path in a Variable and Reading it in another py file? Quick question:
I have a panel.py file, a operator.py file, and a __init__ that puts it all together.

My panel has a class that uses a bpy.types.PropertyGroup to store a PropertyString into a variable called file_path. It also has a class that uses bpy.types.Panel to create the PropertyString like this:

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

    tools = context.scene.worth_group_tools
    selected_path = col.prop(tools, "file_path")


My question is, how do I access this variable on my operator.py page? I've tried:

from . Tools_panel import PT_Panel
def execute(self, context):
   print(PT_Panel.draw.selected_path)
   return {'FINISHED'}


But that doesn't work.  Any suggestions?  My code works fine until I try to print with PT_Panel.draw.selected_path.
You can access the file_path in the operator, just like you did in the panel, by using the context. Through it you get a reference to the same instance of the PropertyGroup that stores your settings.

context.scene.worth_group_tools.file_path will give you the StringProperty.

You cannot access a local variable that only exists in the function scope from outside the object.