Computer Science, asked by adsf1798, 11 months ago

How do we share global variables across modules in Python?

Answers

Answered by Anonymous
0

The way in which global variables can be shared across modules in Python is by creating a special configuration module which is often referred to as config or cfg.

  • This can be done by just importing the configuration module in all modules of the application.
  • This module will then be a global name.
  • Also, there will be only one instance of each module and any changes made to this module object will be  reflected everywhere.

Similar questions