Imported module, connection_status_message.py:
connection_status_message = "Not Connected"
Try Except file, connect_to_server.py:
from Server.connection_status_message import connection_status_message
def connect_to_server(host,user,password):
try:
connect(host,user,password)
except NoConnection:
connection_status_message = "Could not reach host..."
return
...
The issue is the variable is trying to be made local. So I read up on the issue and saw how to reference a global variable:
def connect_to_server(host,user,password):
try:
connect(host,user,password)
except NoConnection:
global connection_status_message
connection_status_message = "Could not reach host..."
return
...
But now PyCharm is stating the import statement at the top is no longer being used.
How can I get this Try/Except to use the imported variable?