0

Need to make a container app that will run different configurations of modules. i.e. container app is A, inside A i can add B that is another script that count, else I can add C that is a script that read a value.

would it be possible with imports? what's the best practice to do it?

A = run a while cicle
B = run some functions
c = run another set of functions

A.py

a=0
while 1:
    import B
    import C

B.py

def pippo():
    print a=a+1
if __name__ == "__main__":
    pippo()
user2239318
  • 2,578
  • 7
  • 28
  • 50

1 Answers1

0

Yes, you do it like this

In A.py

import B
import C
a = 0
while True:
    B.do_something()
    C.do_anotherthing()

In B.py

def do_something():
    "Do Your Stuff"

In C.py

def do_anotherthing():
    "Do your another Stuff"
Syed Habib M
  • 1,757
  • 1
  • 17
  • 30