How to use a variable form main script in a module.

Emile van Sebille emile at fenx.com
Mon Jul 26 10:04:04 EDT 1999


Hi Peter,

You need to fully specify the module variable name in your main program.
For example, if an imported module defines x as an unbound (quasi)class
variable:

>>> x = 3
>>> import testx
>>> x
3
>>> testx.x
15

HTH
--

Emile van Sebille
emile at fenx.com
-------------------


Peter Torstenson <p.t at iname.com> wrote in message
news:7nhmt5$su0 at enews3.newsguy.com...
> This is probaly a silly question from a newbie.
> In my main script I put a value for to a variable called "x".
> Now I want to use the "x" variable in a module.
> The module is imported into the main script. How to do this?
>
> I've been trying to find out how to do it in tutorials an the
reference
> manual but I can´t find anyting written about this. Perhaps because
it's a
> to silly question.
>
> /Peter Torstenson
>
> Rio de Janeiro
>
>






More information about the Python-list mailing list