pipethread is a module by rkeene that implements thread-based concurrency and parallelism. It gives you the | from sh in Tcl, for Tcl code.
proc a {inchan outchan} { puts $outchan blah } pipethread::pipe a | { gets $inchan line; puts $outchan "[string length $line]:$line" }