what specific methods/classes you know work for accessing material properties in UE5.4?

work around script for automatic renaming each ‘texture parameters’. But it always show some error ( something like this… LogPython: Error processing material: ‘Material’ object has no attribute ‘expressions’)

import unreal

def rename_texture_parameters():
try:
print(“Script started…”)

    # Get editor utilities
    editor_util = unreal.EditorUtilityLibrary()
    editor_asset_lib = unreal.EditorAssetLibrary()
    
    # Get selected materials in content browser
    materials_path = "my materials_path"
    print(f"Searching for materials in: {materials_path}")
    
    # Get all assets and filter for materials
    material_assets = editor_asset_lib.list_assets(materials_path, recursive=True)
    asset_registry = unreal.AssetRegistryHelpers.get_asset_registry()
    
    # Filter and load materials
    materials = []
    for asset_path in material_assets:
        asset_data = asset_registry.get_asset_by_object_path(asset_path)
        if asset_data and asset_data.get_class().get_name() == 'Material':
            material = editor_asset_lib.load_asset(asset_path)
            if material:
                materials.append(material)
    
    print(f"Found {len(materials)} materials")
    materials_processed = 0
    parameters_renamed = 0

    for material in materials:
        try:
            print(f"\nProcessing material: {material.get_path_name()}")
            
            # Get all material expressions using the correct method in UE 5.4
            expressions = material.get_editor_property('expressions')
            if not expressions:
                print(f"No expressions found in material: {material.get_path_name()}")
                continue
            
            # Find all texture sample parameter expressions
            texture_params = []
            for expr in expressions:
                if isinstance(expr, unreal.MaterialExpressionTextureSampleParameter) or \
                   isinstance(expr, unreal.MaterialExpressionTextureSampleParameter2D):
                    texture_params.append(expr)
            
            print(f"Found {len(texture_params)} texture parameters")
            
            # Dictionary to map material input types to new parameter names
            name_mapping = {
                unreal.MaterialProperty.MP_BASE_COLOR: 'Base_Color_Map',
                unreal.MaterialProperty.MP_METALLIC: 'Metallic_Map',
                unreal.MaterialProperty.MP_ROUGHNESS: 'Roughness_Map',
                unreal.MaterialProperty.MP_NORMAL: 'Normal_Map',
                unreal.MaterialProperty.MP_OPACITY: 'Opacity_Map',
                unreal.MaterialProperty.MP_EMISSIVE_COLOR: 'Emissive_Map',
                unreal.MaterialProperty.MP_AMBIENT_OCCLUSION: 'AO_Map',
                unreal.MaterialProperty.MP_WORLD_POSITION_OFFSET: 'Height_Map'
            }
            
            for param in texture_params:
                try:
                    old_name = param.get_editor_property('parameter_name')
                    # Try to determine the connection type based on the output connections
                    connected_property = None
                    output_expressions = param.get_editor_property('output_expressions')
                    
                    for connection in output_expressions:
                        if hasattr(connection, 'material_property'):
                            connected_property = connection.get_editor_property('material_property')
                            break
                    
                    if connected_property in name_mapping:
                        new_name = name_mapping[connected_property]
                        if old_name != new_name:
                            try:
                                param.set_editor_property('parameter_name', new_name)
                                print(f"Renamed parameter from '{old_name}' to '{new_name}'")
                                parameters_renamed += 1
                            except Exception as rename_error:
                                print(f"Failed to rename parameter: {rename_error}")
                        else:
                            print(f"Parameter already correctly named: {old_name}")
                    else:
                        print(f"No mapping found for parameter: {old_name}")
                
                except Exception as param_error:
                    print(f"Error processing parameter: {param_error}")
                    continue
            
            # Try to save the material
            try:
                material.modify(True)
                editor_asset_lib.save_asset(material.get_path_name())
                materials_processed += 1
            except Exception as save_error:
                print(f"Failed to save material: {save_error}")
        
        except Exception as material_error:
            print(f"Error processing material: {material_error}")
            continue

    print("\nSummary:")
    print(f"Materials processed: {materials_processed}")
    print(f"Parameters renamed: {parameters_renamed}")
    print("Script completed!")
    
except Exception as e:
    print(f"Critical error in script: {str(e)}")

Execute the function

if name == ‘main’:
rename_texture_parameters()