is it possible to split scripts into two or more subscripts, in order to ease program development and testing? I am thinking of putting tested functions into one script and the main program into another.
I have tried to search examples of this from Telit´s "Easy Scrip in Python" manual but could not find any. Genrally, I understand it is straightforward to do so in Python.
If possible, what penalties and limitations do apply? Does splitting the scripts slow down the excutions speed? Will global variables and call-return parameters get passed from a script to another?
Thanks for any help.
Is not only possible but highly recommended to:
– keep the code organized
– speed startup having a small py file calling the startup function in another precompiled file, all other files being precompiled
– keep files under the max size
Parameters can be passed in function calls or with vars maintained in a dedicated file.
Take a look in Telit Python Examples, SDIO application for such an application organization: sdio.py is the small file acting as application entry point, main.pyo is the main file, sd_raw_drv.pyo the low level SD driver and sd_defs.pyo constants and global variables.
Thanks for your comments, Cosmin. SDIO is an interesting demo of what I meant. But is there a speed penalty when splitting a script into parts, compared to keeping all within one script?
No there aren’t speed penalties.
Hit enter to search or ESC to close
Knowledge Base & Download Zone