I built a package that contains different modules.Everything works, but i have a problem initializing a variable.In the package,i need an init() function to initialize a variable.How can i make this variable available in all my modules/functions?
I tried different things that only work partially.
my_package __init__.py init() subpackage my_function <---- How to use x?**__init.py__** global x def init(initial_value): global x x=initial_value
I want to be able to do:
import my_packagemy_package.init(1234)my_package.subpackage.my_function() <---- Should be able to use x with its 1234 value