How to access bpy.props.StringProperty() from a different class? I need to access the string in 'my_type' string property which reside in the class Append_OT_Operator from the class Apply_OT_Operator. How can I make this 'my_type' a variable that I can access globally? Or is there a better way?

This is my code in my_operators.py:

class Append_OT_Operator(bpy.types.Operator):
    bl_idname = "wm.appending_basic_objects"
    bl_label = "Append the basic objects"

    my_type : bpy.props.StringProperty()

    def execute(self, context):
        path = (r'C:/Users/')
        blendfile = "Assets" + ".blend"

        bpy.ops.wm.append(
            filepath = blendfile,
            directory = path + '/' + blendfile + "/Object/",
            filename = self.my_type)   

        return {'FINISHED'}

class Apply_OT_Operator(bpy.types.Operator):
    bl_idname = "wm.apply"
    bl_label = "Apply most modifiers for UV unwrapping phase"

    def execute(self, context):

        print(my_type) #return an error, instead of printing my_type string


To clarify, 'my_type' is set when the user click on a button of the UI in my ui_panel.py:

class UI_PT_Panel(bpy.types.Panel):
    bl_idname = "UI_PT_Panel"
    bl_label = "Bijoux Panel"
    bl_category = "Bijoux Addon"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

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

        row = layout.row()
        row.operator('wm.appending_basic_objects', text = "append my_object1").my_type = 'my_object1'

        row = layout.row()
        row.operator('wm.appending_basic_objects', text = "append my_object2").my_type = 'my_object2'
Window Manager keeps track of registered operators
Lets say we add a property to the simple operator template, and make it register - undo
class SimpleOperator(bpy.types.Operator):
    &quot;&quot;&quot;Tooltip&quot;&quot;&quot;
    bl_idname = &quot;object.simple_operator&quot;
    bl_label = &quot;Simple Object Operator&quot;
    bl_options = {'REGISTER', 'UNDO'}
    xxx : bpy.props.StringProperty(default=&quot;foo&quot;)

Invoke it from the UI

Then in python console use WindowManager.operator_properties_last
&gt;&gt;&gt; op = C.window_manager.operator_properties_last(&quot;object.simple_operator&quot;)
&gt;&gt;&gt; op.xxx
'ggggg'

Note the template class name is SimpleOperator but really should be OBJECT_OT_simple_operator to match its id name &quot;object.simple_operator&quot; as per the naming convention
Store in blend objects
Alternatively store properties on ID objects in blender, eg scene, object, mesh etc.  Scene is often used as a &quot;global&quot;.
from bpy.props import StringProperty

bpy.types.Scene.xxx = StringProperty()

set in an operator with
context.scene.xxx = self.my_string

retrieve with
print(context.scene.xxx)

layout with
layout.prop(context.scene, &quot;xxx&quot;)