Background execution without locking up the definition?

two parts to the question:

  1. possible to trigger a function using some kind of timer? ie: every 20 sec.
  2. if possible, can it be done without locking up grasshopper? it seems like when code is executing the program waits for it to finish.