I have the below code where I am interested in using the fqdm_or_ip variable in another python file.
This file is menu.py
def CONN_PARAMS():
print("1. FQDN")
print("2. IP ADDRESS")
fqdn_or_ip = input("Are you going to use an IP or FQDN for the controller")
if fqdn_or_ip == 1:
controller = input("Enter FQDN or IP address" )
print("Are you sure this is correct? " + controller)
elseif (fqdn_or_ip) == 2):
controller = input("Enter FQDN or IP address"):
I am using the below code but I am unsure how to move the variable between files...once the menu.py collects answers to my questions the other python file will begin using that information.
This file is the one I am trying to pull the variable into....I think I am supposed to pass the variable into the () of menu.CONN_PARAMS but I was unsure how.
#!/usr/bin/python3
# import requests module for REST API calls
import requests
# import json module
import json
# menu.py
import menu
menu.CONN_PARAMS()
Best,
Dan
fqdn_or_ipseem to be a local variable. Can you pass the variable as an argument to some other function?