3

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"?

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
user1985580
  • 61
  • 2
  • 4

1 Answers1

3

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

glenn jackman
  • 238,783
  • 38
  • 220
  • 352
Nir Levy
  • 4,613
  • 2
  • 34
  • 47
  • 2
    Note to @user1985580, the `source` command will essentially execute program2.tcl within the current program. If program2 does more stuff that just define the procedure, you should extract the procedure into its own file and your program and program2 should both source that new file. That is the essence of creating a Tcl package. – glenn jackman Jan 17 '13 at 11:41