I added a wx.py.shell in my application and I can call/execute my functions within this shell. For example, I can call functions like read(address1), write(address2, data) at the shell prompt one after other. They work fine.
Now I want to place a set of these function calls in a file, named myscripts.py, and execute them once in this shell. How do I do this? When I tried importing this file to execute those functions, it throws error like “NameError: name ‘readd’ is not defined”. I want to know if there is way to execute all the functions like a script.
if you put a function ‘zoomzoom(some_arg)’ in myFile.py… then you import myFile… you call it with myFile.zoomzoom(some_param)
···
On Wednesday, October 22, 2014 9:37:59 PM UTC-7, kruvva wrote:
Hello All,
I added a wx.py.shell in my application and I can call/execute my functions within this shell. For example, I can call functions like read(address1), write(address2, data) at the shell prompt one after other. They work fine.
Now I want to place a set of these function calls in a file, named myscripts.py, and execute them once in this shell. How do I do this? When I tried importing this file to execute those functions, it throws error like “NameError: name ‘readd’ is not defined”. I want to know if there is way to execute all the functions like a script.
I found the solution using execfile('myscripts.py). All the functions within the file are executed. Thank you.
···
On Thursday, October 23, 2014 11:16:26 AM UTC-7, Nathan McCorkle wrote:
if you put a function ‘zoomzoom(some_arg)’ in myFile.py… then you import myFile… you call it with myFile.zoomzoom(some_param)
On Wednesday, October 22, 2014 9:37:59 PM UTC-7, kruvva wrote:
Hello All,
I added a wx.py.shell in my application and I can call/execute my functions within this shell. For example, I can call functions like read(address1), write(address2, data) at the shell prompt one after other. They work fine.
Now I want to place a set of these function calls in a file, named myscripts.py, and execute them once in this shell. How do I do this? When I tried importing this file to execute those functions, it throws error like “NameError: name ‘readd’ is not defined”. I want to know if there is way to execute all the functions like a script.