Python - Calling a function from a class
Question: I'm having some trouble calling a function which is within a class in python.

Here is my folder hierarchy.  
~/Code/program/main.py  
~/Code/program/dc_functions/dcfunc.py  
~/Code/program/dc_functions/**init**.py

Basically, I want to use a function from dcfunc.py inside of main.py. How
would I do this?

Relevant contents of dcfunc.py:

    
    
    import subprocess, string, os, sys
    
    class dcfunc:
        #Create raw Audio track(Part of Dreamcast Disc format) + Burn track to disk.
    
        def __init__(self):
            self.self = "self"  
    
        def burnaudiotrack(device):
            **CODE***
    

Thanks for any suggestions!


Answer: You need your init.py file to be named `__init__.py`

then use

    
    
    from dc_functions.dcfunc import function_name
    

And you'll have acccess to the function.

