It seems a litle confuse, but my task is the following:
I have a personalyzed python module named functions, where I declare many tasks that are often used in my project. One of these functions is read_servers_list()
, this gets a list of servers that an action will be done in. Another function is called automation(command, servers, mixed = False, logs = False, csv = False)
which is responsible for a repetitive task in the servers list defined by the user. Most times, the servers in automation()
are get by the read_servers_list () functions, so i set it as the default value automation(servers -read_servers_list ())
. But I got a problem, when I import the function module into another module (import functions
), the read_servers_list()
is executed twice, once during the import action and another when I use the functions.automation()
.
Could someone help me, I wish to import the functions and execute the read_servers_list()
only when it is called.