Python Forum
Help with variable in between modules
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with variable in between modules
#4
(Jul-31-2023, 03:17 PM)deanhystad Wrote: You are using global wrong. Validator needs to declare loop_valve as global so "loop_valve =+1" doesn't create a local variable named "loop_valve" and assign it the value "loop_valve + 1". You do not need to use "global loop_valve" in the for loop. The for loop is running in the global context, and any variables created in the for loop are global.

Why does Validator open a file every time? Does input.txt change? If input.txt changes, why does it change? Are you using a file to communicate between the generator and the validator? Why? Are they different processes?

Thanks for your reply.
  • Input.txt changes.. Once I am able to workaround this issue, if the generated token/number isn't in the input.txt, another function will append the number into the input.txt.

  • Input.txt is the only file. The idea is to generate an unique token on each run.

  • The 100 times loop is meant to be the number of unique generated tokens written in the input.txt (from function generator)
Reply


Messages In This Thread
Help with variable in between modules - by llxxzz - Jul-31-2023, 02:27 PM
RE: Help with variable in between modules - by llxxzz - Jul-31-2023, 03:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  change value of a global variable across all modules aster 5 5,167 Jan-01-2019, 06:42 PM
Last Post: aster
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,539 May-25-2017, 08:15 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020