How can i move python functions into different .py file?
Question: i want to move functions because of lot of files, into separate python files.
But if i do it, it dont work.

I tried:

File: server.py:

    
    
    import os, cherrypy, json
    from customers.py import *
    
    class application(object):
    
    def get_webpage(self):
    ....
    
    def get_data(self):
    ....
    

File: customers.py:

    
    
    import os, cherrypy, json
    
    def get_customer_data(self):
    ....
    

I use the python as server, the data in the function: get_customer_data is in
this case not processed, get a 404 Not Found, means the function is not
included in main file (server.py)


Answer: I removed the self from get_webpages() because it was not indented, which
means it was not part of the class.

application.py:

    
    
    class application(object):
        def __init__(self):
            pass
    
    def get_webpage():
        print('From application')
    

customers.py:

    
    
    from application import *
    get_webpage()               #  From application
    

You could indent get_webpages() and make it part of the class. The way you
call it would change. (I put the self back and capitalized the name of the
class.)

application.py:

    
    
    class Application(object):
        def __init__(self):
            pass
    
        def get_webpage(self):
            print('From application')
    

customers.py:

    
    
    from application import *
    
    a = Application()
    a.get_webpage()             #  From application
    

