How to get a variable out of a function

I’ve created a script to show what I mean:

Script called Run

AVAILABLE_NUMBERS = [1,2,3,4,5,6,7]

def Try():
  y = 9
  return y
x = 7

Script called Main


from Run import x

#Does not work
from Run import y


Traceback (most recent call last):
  File "", line 5, in <module>
    from Run import y
ImportError: cannot import name 'y'
exited with non-zero status

Not sure what you’re trying to do, but you never run Try() to get y, so y is never assigned. Something like y = Run.Try()

Yes I know that, but I forgott to ask if there’s a way to get it out without running it?
I have something like that:

# module
# color cache
import random

#Thank you monster

#--- module level code 
This code will be called a single time 
when this module gets accessed the first time

# A pseudo constant that defines the initial colors
    , [0,1,0,True]
    , [1,0,0,True]
    , [255,255,0,True]
    , [0.207917,0.105,0.030,True]
    , [2.55,0.20,1.47,True]

# list
availableColors = list(POSSIBLE_COLORS)

#--- BGE  function (argument: controller)
def setRandomColor(controller):

    owner = controller.owner
    pickedColor = random.choice(availableColors)
    owner.color = pickedColor

#Tryed to create variables, but can't output them without running the whole thing - if I do so the random color thing crashes
#define Colors as well as values    
def Numberoutput(pickedColor):    
    pickedColor = setRandomColor(0)
    if pickedColor == availableColors[0]:
        y = blue
    elif pickedColor == availableColors[1]:
        y = green
    elif pickedColor == availableColors[2]:
        y = red
    elif pickedColor == availableColors[3]:
        y = yellow
    elif pickedColor == availableColors[4]:
        y = brown
    elif pickedColor == availableColors[5]:
        y = pink
    return y

I’d like to get y out or connect y with the colors. (BGE)
If I have to run the whole thing, the random color choice doesn’t work anymore.