Nope - you can't even force it by binding a __call__ method to the
module.

For future reference, you can check to see what things *are* callable
with the built-in function 'callable'.

eg (with sys instead of MyApp):

>>> import sys
>>> callable(sys)
False

Also - a thing you can do to sort of do what you want (?) is wrap the
code to be executed by the module in a main() function.  eg:

  #-- Start of MyApp.py --
  def main(foo):
    print "My cat loves", foo

  if __name__ == "__main__":
    import sys
    main(" ".join(sys.argv[1:]))
  #-- EOF --

The main function then lets you either run your module from the command
line (MyApp.py Meow Mix) or have another module use it with:

  import MyApp
  MyApp.main("Meow Mix")

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to