I have a script for which I want something ("This is the script version 1.0" in the example below) to be printed only when imported (or reloaded). Basically, my script has several functions and one class, but somehow (since I upgraded to python 3.8 actually), the first message in the code is printed several time while executing functions in the class. So is there a way to check when I first import the module? The script is basically like this:
import numpy as np
print('This is the script version 1.0')
def func1():
blah blah
def func2():
blah blah
class Open:
def __init__(self, others):
blah blah
def func3(self)
blah blah
def func4():
blah blah
def func5():
blah blah