I'm sure this is an extremely simple question, but I cannot seem to figure it out. I'm getting into python and have use a basic 'hello world' router as an example. I wanted to export the majority of the code to expand the app into multiple files. When all of the code is in a single file, it works fine, but when it is moved into 2 separate files, it bombs. Any help is greatly appreciated.
FIRST FILE
import re # first file
from Primer.Core.router import Router // second file, excluded when all code is in 1 file
# second file code here when combined
def application(environ, start_response):
router = Router(environ, start_response)
return router.run()
SECOND FILE
from cgi import escape
class Router:
def __init__(self, environ, start_response):
self.environ = environ
self.start_response = start_response
def run(self):
path = self.environ.get('PATH_INFO', '').lstrip('/')
if (path == 'hello')
return 'hello'
else
return 'other'