How to pass script file by passing arguments?

Let's say I have a tcl script, and I want to pass some arguments to the second script file, which is in the first tcl:

#first tcl file

source second.tcl

I want to control the second.tcl stream from first.tcl, and I read that the tcl source does not accept arguments. I wonder how I can do this.

+3
source share
2 answers

sourcedoes not accept any additional arguments. But you can use (global) variables to pass arguments, for example:

# first tcl file
set ::some_variable some_value
source second.tcl

The second TCL file may refer to a variable, for example:

# second tcl file
puts $::some_variable

:
, script . , script , . , :

# one joint tcl file
set ::some_variable some_value
puts $::some_variable
+8

"::" - . (, .).

, , : , , , , script. - :

source file2.tcl
setup_state $foo $bar $baz

[source] - , . , , ...

+6

All Articles