Hello,
I am using parts of this script at this link Parcel Fabric Active Record Automation - Esri Community suggested by @KenGalliher1 . I've pasted an extract of my script below. The code works when there is an active record set in the map like this

and returns the id as expected, however once I turn off the active record like this

using the toggle and re run this code, the same record_id for the 'TEST' record is still returned. I only want the record_id returned when in fact there is an active record. It appears that the cim properties are somehow being cached.
Is there a better way to check for an active record or is this a bug with the cim properties? And help would be much appreciated. Thank you
current_project = arcpy.mp.ArcGISProject('current')
# Get the active map
target_map = current_project.activeMap
map_layers = target_map.listLayers()
parcel_layer = [lyr for lyr in map_layers if lyr.isParcelFabricLayer][0]
# get parcel fabric cim properties to return active record
parcel_cim_def = parcel_layer.getDefinition("v3")
cim_properties = [v for v in dir(parcel_cim_def.parcelFabricActiveRecord) if not v.startswith("_")]
active_record = parcel_cim_def.parcelFabricActiveRecord.activeRecord
record_id = str.upper(active_record)