Author Topic: Python questions  (Read 2427 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Python questions
« on: February 12, 2015, 01:21:41 PM »
I have few questions regarding python that I could not find an answer here or in python documentation ...

1. recurring print function will eventually make the Python log (that we see in Py plug-in window) eventually grow big.  will that lead to more memory consumption by VC?
2. is there a way to unload python script?
3. function declared in scripts are they global, I mean can I declare a function in script A and call it in script B?
4. would reloading the scripts overwrite the older one, ex. a script that has a loop that triggers event ... if loaded twice will the event be triggered twice?

tx for any feed back
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Python questions
« Reply #1 on: February 12, 2015, 02:43:18 PM »
I have few questions regarding python that I could not find an answer here or in python documentation ...

1. recurring print function will eventually make the Python log (that we see in Py plug-in window) eventually grow big.  will that lead to more memory consumption by VC?
2. is there a way to unload python script?
3. function declared in scripts are they global, I mean can I declare a function in script A and call it in script B?
4. would reloading the scripts overwrite the older one, ex. a script that has a loop that triggers event ... if loaded twice will the event be triggered twice?

tx for any feed back

1 - Correct.  Normal scripts should not use repeating calls to print.  Use nothing, or vc logging, or write to your own text files from python instead.
2 - Have you looked at the available python actions?  There is PY.ReInit but that clears everything.  To do individual stuff you'll need to use python to do it.  This means declaring proper classes of objects, instantiating them and destroying them when you are done with them.
3 - See 2.  depends how you declare stuff, this is a python question, but basically yes.
4 - Depends on the actual code.  You can answer this yourself by testing.