On 11/18/22 02: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 ]

Kind of seems like a code smell.  I think you would normally
just inject the dependencies like:

        module_b.do_thing("Hi there!")

If you really want to have a module-global space,
you could just create a module globals.py, and
import that in every module that needs to share globals.
You can just do globals.message = "Hi there!" and
from another module do print globals.message.






--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to