I would like to build a button template, which accepts as a custom parameter a string defining a
project script to run. I tried using "exec()" but it doesn't seem to work (see test in Script console screen shot below), no print output...
i.e. In the project library define some functions. In the button template call the function passed to it in the custom parameter string...
Can't use runScript() since it's an expression function.
This is an astonishingly bad idea. Consider allowing a function name that must already exist in the project, and then you don't need exec(). Instead, use python's getattr to look up the function name in the project library, which will give you a function object, which you can then run directly.
The use of exec and eval are considered to be a bad practice due to injection risks. Even if it seems safe for use in your smoker oven project, I still recommend avoiding unsafe practices for the sake of developing good habits.