It might be a silly question, but when I thought, that my Python skills are good enough I encountered a problem.
I started validating my skills writing a program. It got bigger and bigger so I decided to split it in a few files. I use threading so I'm passing some args to the functions which are in separate files now. Initially I had problems with making variables global, but eventually I could make some of them global. I do need global variables to change their values from different parts of program (those separate files/modules). The exact structure that makes me troubles is like this:
Code: Select all
#main file with variable <path> which I want to pass over to module2 (separate file with <thread_func> function)
another_thread = threading.Thread(target=module2.func, args=(path))
timelapse_thread.start()
#module2 file that is structured as below
def func():
def another_func():
'''some code'''
class MyClass():
def do_something():
'''some code'''
another_func()
'''some code'''
something_that_uses_the_class(MyClass)
#some code
returnThanks!