It's not clear what you are trying to achieve.
1. One way is to store the value in a file (or back in the database) and then read it from y.tcl.
# 1.a (working with files) add this to the end of x.tcl file
set fp [open somefile.txt w]
puts $fp $count_num
close $fp
# 1.a (working with files) add this to the beginning of the y.tcl file
set fp [open somefile.txt]
set count_num [read $fp]
close $fp
# 1.b (working with db) add this to the end of x.tcl
# there are countless ways to do this, this is just a very basic example
# of what you can do. obviously, you would have to creat the table first:
# create table sometable (count_num integer);
db_dml delete_previous_count "delete from sometable"
db_dml save_count "insert into sometable (count_num) values (:count_num)"
# 1.b (working with db) add this to the beginning of y.tcl
set count_num [db_string get_count "select count_num from sometable"]
2. Another way is to source x.tcl in y.tcl but this would not work as you don't have the arguments of x.tcl in y.tcl. In any case, this is what you would need to do if you did have them:
# add this to the beginning of the y.tcl file
source x.tcl
3. Is this done in the context of a web app? Then, you have a form with those values and an action=y.tcl, which will then read the submitted query params with an ad_page_contract, i.e.:
# add this to the beginning of y.tcl
ad_page_contract {
@author yourname
} {
count_num:integer
}
PS. If you were to clarify what "getting count_num in y.tcl file" really means, it would be easier for us to answer.