tornado.options.Error: Option already defined in
I'm learning tornado now, and I think it's an excellent framework.
Everything is well until I separate some methods from main.py. 

For example:

In the main.py which is my server startup program. I use tornado.options.define to define some properties like this:

    define("port", default=8888, help="run on the given port", type=int)
    define("mysql_host", default="127.0.0.1:3306", help="blog database host")
    define("mysql_database", default="forum", help="database name")
    define("mysql_user", default="root", help="database user")
    define("mysql_password", default="passwd", help="database password")

And there is a BaseHandler in it:

    class BaseHandler(tornado.web.RequestHandler):
    @property
    def db(self):
        return self.application.db

    def get_current_user(self):
        return self.get_secure_cookie("username")

And in another file, such as topic.py, every handler in the topic.py will extend BaseHandler in main.py, so I import BaseHandler like this:
    
    from main import BaseHandler

Then the problem happen when I startup my program:

    Traceback (most recent call last):
      File "/Users/abc/money/main.py", line 85, in <module>
        define("port", default=8888, help="run on the given port", type=int)
      File "/Library/Python/2.7/site-packages/tornado-2.2-py2.7.egg/tornado/options.py", line 93, in define
    options[name].file_name)
    tornado.options.Error: ('Option %r already defined in %s', 'port', '/Users/suyejun/Dropbox/money/main.py')

How can I avoid this kind of problem? Or is there another way to write the code?

Thank u very much.
tornado.options.Error: Option already defined in
===

I'm learning tornado now, and I think it's an excellent framework.
Everything is well until I separate some methods from main.py. 

For example:

In the main.py which is my server startup program. I use tornado.options.define to define some properties like this:

    define("port", default=8888, help="run on the given port", type=int)
    define("mysql_host", default="127.0.0.1:3306", help="blog database host")
    define("mysql_database", default="forum", help="database name")
    define("mysql_user", default="root", help="database user")
    define("mysql_password", default="passwd", help="database password")

And there is a BaseHandler in it:

    class BaseHandler(tornado.web.RequestHandler):
    @property
    def db(self):
        return self.application.db

    def get_current_user(self):
        return self.get_secure_cookie("username")

And in another file, such as topic.py, every handler in the topic.py will extend BaseHandler in main.py, so I import BaseHandler like this:
    
    from main import BaseHandler

Then the problem happen when I startup my program:

    Traceback (most recent call last):
      File "/Users/abc/money/main.py", line 85, in <module>
        define("port", default=8888, help="run on the given port", type=int)
      File "/Library/Python/2.7/site-packages/tornado-2.2-py2.7.egg/tornado/options.py", line 93, in define
    options[name].file_name)
    tornado.options.Error: ('Option %r already defined in %s', 'port', '/Users/suyejun/Dropbox/money/main.py')

How can I avoid this kind of problem? Or is there another way to write the code?

Thank u very much.