from imserver.imserver import main, bottle

if __name__ == '__main__':
    main(*bottle.sys.argv)

from .imserver import main, bottle

if __name__ == '__main__':
    main(*bottle.sys.argv)

Update __main__.py