I updated your example to work in place. You have to return both variables and can also assign them on the return:
cardName = "test"
cardValue1 = 0
def random_card():
number = (random.choice(cardsList))
suit = (random.choice(suitList))
cardName = number + suit
print (cardName)
if cardName.startswith('A'):
print ("Do you want this card to count as a 1 or 11?")
oneOrEleven = input()
if oneOrEleven == ("11"):
cardValue1 = 11
else:
cardValue1 = 1
elif cardName.startswith("2"):
cardValue1 = 2
elif cardName.startswith("3"):
cardValue1 = 3
elif cardName.startswith("4"):
cardValue1 = 4
elif cardName.startswith("5"):
cardValue1 = 5
elif cardName.startswith("6"):
cardValue1 = 6
elif cardName.startswith("7"):
cardValue1 = 7
elif cardName.startswith("8"):
cardValue1 = 8
elif cardName.startswith("9"):
cardValue1 = 9
elif cardName.startswith("1"):
cardValue1 = 10
elif cardName.startswith("K"):
cardValue1 = 10
elif cardName.startswith("Q"):
cardValue1 = 10
elif cardName.startswith("J"):
cardValue1 = 10
else:
a = 1
print ("Your card is '",cardName,"'","and it is worth",cardValue1)
return cardValue1, cardName
cardName, cardValue1 = random_card()
print (cardName)
print (cardValue1)