TCL calling proc that is in another file, but the proc is not found: invalid command

user1985580 picture user1985580 · Jan 17, 2013 · Viewed 7.2k times · Source

I am new to TCL. I excute TCL code via: "tclsh85 FOD/Scripts/program1.tcl" from DOS window under Windows Vista.

program1.tcl included a "set junk [tproc $a]" and this give "invalid command name tproc".

tproc is defined in program2.tcl which is in directory "c:a/b/lib". What do I need to do to have TCL find the proc when I run "tclsh85 FOD/Scripts/program1.tcl"?

Answer

Nir Levy picture Nir Levy · Jan 17, 2013

Did you source program2.tcl in program1.tcl ?

If not then you need to source "program2.tcl" before calling tproc

See http://tcl.tk/man/tcl8.5/TclCmd/source.htm

You should also familiar yourself with the Tcl package command at http://wiki.tcl.tk/9859