What is base in the first example?
Do you see any errors in the script console?
Have you tried to execute your scripts in the script console to debug them?
Have you added some prints to debug what is going on?
AddCommandsAfterBuild is the correct function/method to call if you want to add post build commands.
There are very few APIs which work only in wizards. Most of the APIs work everywhere. moviesda
What constitutes the base in the initial example?
Do you observe any errors displayed in the script console?
Have you attempted to execute your scripts within the script console for debugging purposes?
Have you incorporated print statements to facilitate debugging and understand the current behavior?
AddCommandsAfterBuild represents the appropriate function or method to invoke when you intend to incorporate post-build commands.
The majority of available APIs function across various contexts, with only a limited number of APIs restricted exclusively to wizards.