Call up a function from another module Call up a function from another module tkinter tkinter

Call up a function from another module


Importing a module has no effect on what the module you import can see. If you want to use mod1 contents in mod2 and mod2 contents in mod1, you need to have them import each other and refer to each other's contents with the appropriate module:

# mod1import mod2...    button2.config(text = "continue", command = mod2.func2)# mod2import mod1def func2():    mod1.button2.destroy()

Circular imports cause nasty initialization order issues, though, so imports like this are a bad idea. When dividing your code into modules, try to do so in such a way that import loops like this aren't necessary.