pymel.core.context.ctxAbort

ctxAbort(*args, **kwargs)

This command tells the current context to reset itself, losing what has been done so far. If a escape context has been set it then makes that context current.

Derived from mel command maya.cmds.ctxAbort

Example:

import pymel.core as pm

# Create a new particle tool context, then switch to it
pm.dynParticleCtx('dynParticleCtx1')
pm.setToolTo('dynParticleCtx1')
# Click the positions where you want to place the particles

# This command will reset the particle tool, clear the particles you have just created
pm.ctxAbort();