title: How to put sleep command in a tcl script?
body: <p>I'm trying to put a sleep command in a tcl script to wait 10 seconds before send the disconnect command:</p>
  
  <pre><code>#!/usr/bin/expect -f
  
  set n 0
  
  if { $argc != 1 } {
          puts "The script requires the number of bot."
          puts "Please try again."
          exit 1
      } else {
          set n [lindex $argv 0]
          }
  
  # Spawn Python and await prompt
  spawn mono --debug pCampBot.exe -loginuri http://127.0.0.1:9000 -s home -n $n -firstname test -lastname bot_ -password 123 -b p
  expect "pCampbot#"
  
  # Send Python statement and await prompt
  send "conn\n"
  expect "pCampbot#"
  
  sleep 10
  
  send "disconn\n"
  expect "pCampbot#"
  
  # Pass control to user so he can interact with Python
  interact
  </code></pre>
  
  <p>The problem is that sleep command it's like it's executed after the spawn command, that is it waits 10 seconds and after send "conn" and "disconn" commands sequentially.</p>
  
  <p>I don't know why it behaves like that and i don't know how i can solve this problem.</p>