Global object

G

Ghido

Hi all, i need to save in an object some variable for use in other
parts of my software. it's possibile without create an istance of this
class in every file? if yes how?
thanks a lot

Ghido
 
S

Steven Bethard

Ghido said:
Hi all, i need to save in an object some variable for use in other
parts of my software. it's possibile without create an istance of this
class in every file? if yes how?

Create a module, say, ``config``. Then to save your object, you use
something like::

import config
config.value = value_to_save

Now if you want to access it from other parts of your program, simply
write::

import config
do_something_with(config.value)



STeVe
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top