Hi @rimi
Although not really dynamic, because code was predefined, I’ve used a kind of dynamic behavior in some wikis by using the \import pragma (doc here) or the <$importvariables> widget (doc here).
Both use a parameter which is a filter, so you can trick them to import a set of procedures/functions/macros from a tiddler whose title -or titles- is based on variable content returned by the filter.
Example where the code tiddler is computed based on a field value:
\import [<currentTiddler>get[myField]addprefix[$:/me/my-code-tiddlers/]]
Then you have 2 options:
- each function/procedure has a standard interface (ie name+parameter set) so you already know how to use it
- functions/procedures define their interfaces in fields or data tiddlers that you’ll use to call them
Example of option 1:
In tiddler $:/me/my-code-tiddlers/code1 you define
\procedure btn-click(template)
<$action-createtiddler $basetitle="base1" $template=<<template>> tags="tag1"/>
\end
In tiddler $:/me/my-code-tiddlers/code2 you define
\procedure btn-click(template)
<$action-createtiddler $basetitle="base2" $template=<<template>> tags="tag2"/>
\end
And in the calling tiddler, you import one of these code tiddlers based on myField field value and you use it like this:
\import [<currentTiddler>get[myField]addprefix[$:/me/my-code-tiddlers/]]
<$button actions="""<$transclude $variable="btn-click" template={{!!myTemplate}}/>""">New tiddler</$button>
Example of option 2:
In tiddler $:/me/my-code-tiddlers/code1 you define
\procedure addtiddler()
<$action-createtiddler $basetitle="base1" $template="template1">> tags="tag1"/>
\end
In tiddler $:/me/my-code-tiddlers/code2 you define
\procedure deletetiddler()
<$list filter="[<todel>!is[blank]is[tiddler]]" variable=none>
<$action-deletetiddler $tiddler=<<todel>>/>
</$list>
\end
In the calling tiddler, you import one of these code tiddlers based on myField field value, and you call a procedure whose name is in action-proc-name field, like this:
\import [<currentTiddler>get[myField]addprefix[$:/me/my-code-tiddlers/]]
<$let
todel={{{[[some filter based on context]]}}}
>
<$button actions="""<$transclude $variable={{!!action-proc-name}}/>""">Go!</$button>
</$let>
Not sure all this is clear, as those example are quite weak, but I hope you get the point anyway… 
Fred