imported var not being updated

A

Alex Hall

Hello all:
I have a project with many pyw files. One file holds a variable and a
function that I find myself using across many other pyw files, so I
called it helpers.pyw. The variable is "mostRecent", which is a string
and is meant to hold a string so I know what the program most recently
output; in all the other pyw files, every time the program outputs
something, I include the line
helpers.mostRecent=output
where output is a string and helpers has been imported.

The problem is that mostRecent does not seem to be updated at all, and
I cannot figure out why. I declare it with empty quotes initially, but
the program should keep updating it. Everytime I go to see what its
value is, though, it is still apparently empty. Here is a basic
sample:

randomFile.pyw
---
import helpers

def something():
output="I am the most recently output string!"
helpers.mostRecent=output
#end def

file2.pyw
---
from helpers import mostRecent

print(mostRecent) #prints nothing

Any thoughts on what I am doing wrong? Thanks!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top