0

I would like to know please, how can I define variables in a python file and share these variables with their values with multiple python files?

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Wallflower
  • 550
  • 1
  • 4
  • 13

2 Answers2

1

To do this, you can create a new module specifically for storing all the global variables your application might need. For this you can create a function that will initialize any of these globals with a default value, you only need to call this function once from your main class, then you can import the globals file from any other class and use those globals as needed.

0

You can create a python module Create a py file inside that module define variables and import that module in the required places.

abak1802
  • 109
  • 1
  • 7