Clone a session

You can create an identical copy (clone) of a session using the command CloneSession. The following example copies the current session including the contents of the folder _sessiondir and the session parameters.

 CloneSession;

The new session is created with a new session identifier. After the command CloneSession completes, this new session identifier can be retrieved from the variable _new_session. The script continues to run in the original session context.

KCM ComposerUI

KCM ComposerUI uses sessions to store answers to interactive screens and (optionally) cached data. This information is included when the session is copied. When implementing a scenario where sessions are copied, consider whether KCM ComposerUI caching should be enabled and possibly remove any cache files when restoring a session.