Determines whether the given dataset or workspace is in an edit session.


The IsBeingEdited method can be used to check if a data source is currently in an edit session. This is similar to the isEditing property on the Editor class but does not require you to create the Editor object. This can be useful to use on data sources in which multiple users or automated scripts are trying to perform edits at the same time.


IsBeingEdited (dataset)
ParámetroExplicaciónTipo de datos

The input dataset or workspace to be checked for an ongoing edit session.

Valor de retorno
Tipo de datosExplicación

True if the input dataset or workspace is in an edit session.

Muestra de código

IsBeingEdited example 1

The following code checks if the workspace is already in an edit session before starting a new one.

import arcpy

arcpy.env.workspace = r"C:\data\myGDB.gdb"

if not arcpy.IsBeingEdited(arcpy.env.workspace):
    edit = arcpy.da.Editor(arcpy.env.workspace)
IsBeingEdited example 2

The following code lists the name of any feature layers in a map that have pending edits.

import arcpy

aprx ="CURRENT")
map = aprx.listMaps()[0]

for lyr in map.listLayers():
    if lyr.isFeatureLayer and arcpy.IsBeingEdited(lyr):