How to prevent modules code execution from module in python?
You can't, when you import a module, it runs everything that is called in the global scope.
You can change it so that it's easy to call or not:
def main():
Fu().baz()
if __name__ == '__main__':
main()
And then when you want it called you import it and call main()
and it will still automatically run when you run it as the main module.