Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • No pi handy at the mo to test but does the second start get executed? You can tell by putting a simple print(‘Starting 2nd’) between the two start lines. My gut feel is that it does not execute as flask takes over the main environment but that could be totally wrong :). I would be tempted to split the program into two - one web services, one read csv etc as the Pi is multi-tasking but if you want it all in one edureka.co/community/30828/… may help. Commented Jun 23, 2020 at 14:03
  • @Andyroo i was thinking of splitting it as well and just start it as 2 separate programs; though i dont know yet (as mentioned, im not an expert at Python) if i can set a variable from script A in script B (e.g. to break the loop) as they run completely seperate from eachother Commented Jun 24, 2020 at 5:49
  • Passing variables between programs is a pain - I normally cheat and use a file in ram disk or a database that handles multiple simultaneous access. This is one of the advantages of threading / multiprocessing - maybe looking at the multiprocessing module may work. Did you try the print I mentioned? Commented Jun 24, 2020 at 10:34
  • @Andyroo seems i got it woking now (edited my post with the working solution) though i still don't understand why it works now, and what was wrong in the first instance. Commented Jun 24, 2020 at 11:04
  • 1
    NICE THIS IS SWEET! Thanks for the post & edit Commented Jun 13, 2021 at 20:16