I am trying to replay the game when I run out of guesses (Play again when I run out of gusses or find the right answer)

you forgot to mention the function name playOneRound. The code below works fine.

import random

MAX_GUESSES = 5  # max number of guesses allowed

MAX_RANGE = 20  # highest possible number

# show introductionpygame
print("welcome to my franchise guess number game")
print("guess any number between 1 and", MAX_RANGE)
print("you will have a range from", MAX_GUESSES, "guesses")

def playOneRound():
    # choose random target
    target = random.randrange(1, MAX_RANGE + 1)

    # guess counter
    guessCounter = 0

    # loop fovever
    while True:
        userGuess = input("take a guess:")
        userGuess = int(userGuess)

        # increment guess counter
        guessCounter = guessCounter + 1

        # if user's guess is correct, congratulate user, we're done
        if userGuess == target:
            print("you got it la")
            print("it only took you", guessCounter, "guess(es)")
            break
        elif userGuess < target:
            print("try again, your guess is too low.")
        else:
            print(" your guess was too high")

        # if reached max guesses, tell answer correct answer, were done
        if guessCounter == MAX_GUESSES:
            print(" you didnt get it in ", MAX_GUESSES, "guesses")
            print("the number was", target)
            break

        print("Thanks for playing ")

    # main code

while True:
    playOneRound()  # call a function to play one round of the game
    goAgain = input("play again?(press ENTER to continue, or q to quit ):")
    if goAgain == "q":
        break