import os def a(): print("A") def b(): print("B") # I want to sometimes skip the main body if os.path.isdir("C:\\Blender\\mainbody"): print("main body of module_A")
Is there a way to control whether or not the main body of a module gets executed by passing in arguments to the import command, such as
import module_A "mainbody"
Right now I am controlling it by checking for existence of a directory, I know I could also open some kind of config file which is essentially the same approach but how about just passing in an argument along with import xxx ????