When I run this fabfile.py...
fabfile.py
from fabric.api import env, run, local, cd def setenv(foo): env.hosts = [\'myhost\'] def mycmd(foo): setenv(
I have figured out how to make it work:
from fabric.api import env, run, local, cd def setenv(foo): env.hosts = ['myhost'] return env def mycmd(foo): env = setenv(foo) print(env.hosts) run('ls')