Global object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ghido

    #1

    Global object

    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

  • Steven Bethard

    #2
    Re: Global object

    Ghido wrote:
    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_wi th(config.value )



    STeVe

    Comment

    Working...