I have a package of python modules that I need to import to another module. Wi use of user input of a string or interger, the module is to iterate over the list of the modules to find the one with an answer as follows.

from hometests.clauses import * # imports all modules/functions
import re
import sys

GAMES = [ 'answer_neg1', answer_neg2', 'answer_neg3', 'answer_neg4', answer_neg5', 'answer_pos1', 'answer_pos2', answer_pos3', .....] #imported modules/functions

while true:
    if key in name:
       break
    elif:
       for key,func in GAMES:
           func()
    else:
        print( 'no game for that, please try again')# THE PROBLEM IS THAT IT ALWAYS PRINTS HERE AND NOT ITERATING OVER THE GAMES LIST

SAMPLE MODULE:

import sys
import re
import clause
name = input('Please enter your word here').lower()
name2 =name[:]
for item in name2:
    if item == clause:
        print(......
        code

Why to use import like this, modules are supposed to be modular?

Perhaps try this code snippet. Also please post code with correct syntax, preferably runable code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.