Your recommendation is of course correct, but according to the docs, it is technically possible to fire an extension function from a script using the invoke helper function.
I tested this and was able to programmatically fire the configureChart extension function from a button using the following script: