When I import a function from a Python file, I don't want it to be executed whole. I only want the function to be imported. Currently when I import the function, the a.py file gets executed.
a.py
def func():
print("inside func")
print("outside func")
b.py
from a import func
func()
print("in B")
Output
outside func
inside func
in B
Expected/wanted
inside func
in B