You can execute MEL commands and procedures in an expression. However, if you make or break connections or add or delete nodes, your scene might malfunction.
Rewinding your animation does not undo MEL command execution in an expression. For instance, if your expression executes MEL commands to create a pair of spheres, rewinding doesn’t delete the spheres. Moreover, playing the scene again creates another pair of spheres.
Though you can undo MEL commands by selecting Edit > Undo, this might not work if your scene is malfunctioning. Note also that you can undo only as many operations as is allowed by the Queue Size setting. To set the Queue Size, select Windows > Settings/Preferences > Preferences and display the Undo section.
When you execute a command from the Command Line, status information appears in the Script Editor and the Command Line’s response area. This information is not displayed when a command executes in an expression.