How to store a list or an array with python so its global available?
Two methods:


Method 1: python way


import bpy

arr = ["string1", "string2"]

class ClassName(bpy.types.Operator):

    def execute(self, context):
        for str in arr:
        print(str)

    return {'FINISHED'}

classes = (
    ClassName,
)

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)

if __name__ == "__main__":
    register()




Method 2: Blender way


import bpy

class Variables(bpy.types.PropertyGroup):
    string1: bpy.props.StringProperty(name="a string")
    string2: bpy.props.StringProperty(name="another string", default="default value")

class ClassName(bpy.types.Operator):

    def execute(self, context):
        bpy.context.scene.var.string1 = "Hello World"
        print(bpy.context.scene.var.string1)
        print(bpy.context.scene.var.string2)

    return {'FINISHED'}


classes = (
    ClassName,
    Variables,
)

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)
    bpy.types.Scene.var = bpy.props.PointerProperty(type=Variables)

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)      
    del bpy.types.Scene.var

if __name__ == "__main__":
    register()




learnt from: Godot Game Tools

edit: 
this is how you can access a variable in blender from anywhere. I've used GodotGameTools as an example and also highlighted what it should have been if you used my code