'Trying to use a variable that is inside a function in another function v2
So in my last post i had the problem with function in another function. There 2 people woho helped me but now if i typing a badword the is "Message send!" but why? In addition i post now the 3rd file which is named "badwords_check.py". Probably you can understand the program and my problem more.
from properties.message import msg
from properties.badwords import BadWords
def badwords_check():
if any(word in msg for word in BadWords):
print("Dont use that word!")
else:
print("Message send!")
here are also the other 2 programs from the other post(If you do not understand this well, please see the other post).
One of them is the "message.py" file, that is in the folder "properties". The file looks like this:
def nachricht():
global msg
msg = input("Type: ")
return msg
The other file is the "badwords_check.py", that is in the folder "module". This file looks like this:
from properties.message import msg
from properties.badwords import BadWords
def badwords_check():
if any(word in msg for word in BadWords):
print("Dont use that word!")
else:
print("Message send!")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
