how to get the variable values from two different script
I have script something like this
##########################################################
first script.tcl
proc firstscript {} {
variable i
set i 10
}
#=======================================================
secondscript.tcl
proc secondscript {} {
variable i
puts $i
}
i struggling lot because of this problem.
I ran the first script, in the script I set the variable set i 10
i want get variable value $i in the second script
i tried with global , variable options
Please give some suggestion or solution
Thanks in advance
Thanks and Regards
P.Varthamanan
Answers
-
Altair Forum User said:
I have script something like this
##########################################################
first script.tcl
proc firstscript {} {
variable i
set i 10
}
#=======================================================
secondscript.tcl
proc secondscript {} {
variable i
puts $i
}
i struggling lot because of this problem.
I ran the first script, in the script I set the variable set i 10
i want get variable value $i in the second script
i tried with global , variable options
Please give some suggestion or solution
Thanks in advance
Thanks and Regards
P.Varthamanan
it's due to variable i was not declared in any namespace by 'variable' keyword before
to access global variables, use variable with full name, for example 'set ::i 10', 'puts $::i'
0