'while true: + function + name ' ' is not defined

this the code .. it started with importing other packages :

def WHOLE_SMLE():
    try:
        while True:
            Riyadh_city()
            Jiddah_city()
            AHSA_city()
            Buridah_city()
            Madina_city()
            Hail_city()
            Taif_city()
            TABUK_city()
    except (NoSuchElementException, KeyboardInterrupt, Exception ):
        print('ExCEPT errrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrror')
        WHOLE_SMLE()
        pass
WHOLE_SMLE()

the project will work in a loop .. But unfortunately it worked only for one time then it will shows this error :

    line 14, in WHOLE_SMLE
    Riyadh_city()
NameError: name 'Riyadh_city' is not defined


Solution 1:[1]

The solution depends on how those function are defined on the files you are importing and without them we cannot help you so please make a reproducible example.

I assume you may want to call them using the classs name, if they are in a class (e.g. Taif.Taif_city() if in Taif.py you defined a class Taif onto which you have the method Taif_city()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DaSim