Passing variable between modules

It’s really very simple. A module defines names with some values (once it has executed). You can use the names from another module.

The module gets executed the first time it gets imported anywhere. You were closest with your first attempt, but it goes like this:
Test1.py:

myVar = True
print("1myVar:", myVar)

Test2.py:

import Test1

print("2myVar:", Test1.myVar) 

def myFunc():
    print("3myVar:", Test1.myVar)

myFunc()

And to illustrate another possibility, Test3.py:

from Test1 import myVar
from Test2 import myFunc

print("3myVar:", myVar) 

myFunc()

We don’t generally call this “passing” a value. You pass arguments to a function, but that usually lives only as long as the call. Exporting, publishing, … something like that.

Generally you avoid changing the value of a name from another module because when you find in debugging that it is something surprising, it is difficult to work out who changed it.