Passing information between modules

Axy axy at declassed.art
Fri Nov 18 14:28:24 EST 2022


On 18/11/2022 10:53, Stefan Ram wrote:
>    Can I use "sys.argv" to pass information between modules
>    as follows?
>
>    in module A:
>
> import sys
> sys.argv.append( "Hi there!" )
>
>    in module B:
>
> import sys
> message = sys.argv[ -1 ]

This idea has a couple of flaws so can be regarded as bad.

However, if nothing else works (including suggested globals.py module), 
then os.environ could be a better way.

Axy.



More information about the Python-list mailing list