#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Question Multiple Scripts or Functions at Once


    I am fairly new to coding, and am much better modifying others code to work for my own applications than to write my own from scratch.

    I currently have been experimenting with the Raspberry Pi, specifically its control of the GPIO pins.

    I have several python scripts that control different components (ex. temp sensor, light sensor, relays, push button). Each component is controlled by a separate script, and the relay one is controllable though a web interface.

    What is a suitable (and efficient) method to consolidate all the scripts into one? Should I have each as a separate function, all in one large function? Something completely different?

    Any help would be greatly appreciated. Thanks.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    158
    Rep Power
    3
    I think the most "pythonic" way would be to have a master script that imports the various worker-bee scripts, as modules, and executes them in the order or upon events as appropriate.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0
    Thanks for the advice, I'll see what I can come up with!

IMN logo majestic logo threadwatch logo seochat tools logo