Why the function is running?

I have a library:
from colorama import Back, Style, Fore
from colorama import init
init()

def E404():
 print(Fore.RED + "I'm Sorry... There is error:")
 print(Fore.RED + "apt-get - 404")
 print(Back.GREEN + "Description:")
print(Style.RESET_ALL)
 print(Back.GREEN + "while downloading your package has error 404, it means that your package was not found!")
 print(Back.GREEN + "Try to go at: programms.tsecret.xyz and there to find my program")


And when I import it straightaway, and I wonder how to do that-be a function E404 invoked only when it is called
Thanks in advance)
April 3rd 20 at 18:44
2 answers
April 3rd 20 at 18:46
Given your code if you import only calls the init and declares the function. The function body is not executed.
Start with a message:
function E404 at 0x03570340 - Diego.King commented on April 3rd 20 at 18:49
@Diego.King, if she runs, the message would be "I'm Sorry... There is error:" and then. - Pearlie_Dietri commented on April 3rd 20 at 18:52
@Diego.King, This is all your code ? I think not.
Usually messages of this format are if you do so;
def foo():
pass
print(foo)

And display something like this:
<function foo at 0x0000023A25AF0D90> - Lenny commented on April 3rd 20 at 18:55
@Pearlie_Dietri, it also displays - Diego.King commented on April 3rd 20 at 18:58
@Lenny, Yes it is a whole code library - Diego.King commented on April 3rd 20 at 19:01
@Diego.King, I'll SAY it AGAIN ! JUST SO NOTHING GETS DONE !
Where you use such a design print(funcname). - Lenny commented on April 3rd 20 at 19:04
@Diego.King, and should not. The question goes into a state of mysticism, that it is impossible to obtain. - Pearlie_Dietri commented on April 3rd 20 at 19:07
April 3rd 20 at 18:48
I'm sorry... Here the error:

80lvl of samarasinha.

Find more questions by tags Python