Rearranging elements of a panel
Inserting UI elements in between existing properties is not supported at the moment. Also editing python files that come with blender is bad practice.

You can use append() or prepend() in order to add elements to the user interface of existing Panels, Headers and Menus:



import bpy

def draw_my_properties(self, context):
    scene = context.scene
    layout = self.layout

    # display properties and values
    col = layout.column(align=True)
    col.label("My Values:")
    col.prop(scene.render, "fps", text="FPS")
    col.prop(scene, "frame_start", text="Frame Start")

def register():
    # lets add the menu to the Mesh Display panel via append or prepend
    bpy.types.VIEW3D_PT_view3d_meshdisplay.prepend(draw_my_properties)

def unregister():  
    # remove the menu
    bpy.types.VIEW3D_PT_view3d_meshdisplay.remove(draw_my_properties)

if __name__ == "__main__":
    register()


More information and Addon code: https://blender.stackexchange.com/a/34490/3710



However, here is some kind of hack based on this answer. Following Add-on code injects UI elements into the associated python file on the fly (space_view3d.py in this case). It's also equipped with a prepend() fallback if the specified line cannot be found:



bl_info = {
    "name": "UI Elments In-Between",
    "version": (0, 0, 1),
    "blender": (2, 75, 0),
    "location": "Edit Mode Property Panel (N) &gt; Mesh Display",
    "description": "",
    "warning": "",
    "wiki_url": "",
    "tracker_url": "",
    "category": "Development"}

import bpy

def draw_item(self, context):
    layout = self.layout
    scene = context.scene
    layout.prop(scene.render, "fps", text="FPS")

class DrawFuncStore:
    bpy_type = "VIEW3D_PT_view3d_meshdisplay"
    bpy_type_class = getattr(bpy.types, bpy_type)
    draw = None

def insert_menu():
    insert_after = 'col.label(text="Normals:")'
    insert_code  = '    col = layout.column(align=True)\n'\
                   '    col.label(text="My Values:")\n'\
                   '    col.prop(scene.render, "fps", text="Fps")\n'\
                   '    col.prop(scene, "frame_start", text="Frame Start")\n'

    DrawFuncStore.draw = DrawFuncStore.bpy_type_class.draw
    #module = bpy_type_class.__module__

    filepath = DrawFuncStore.bpy_type_class.draw.__code__.co_filename
    #print ("filepath: ", filepath )
    if filepath == "&lt;string&gt;":
        return
    try:
        file = open(filepath, "r")
        lines = file.readlines()
    except:
        append_menu()
        return

    line_start = DrawFuncStore.bpy_type_class.draw.__code__.co_firstlineno - 1

    for i in range(line_start, len(lines)):
        line = lines[i]
        if not line[0].isspace() and line.lstrip()[0] not in ("#", "\n", "\r"):
            break

    line_end = i

    # Unindent draw func by one level, since it won't sit inside a class
    lines = [l[4:] for l in lines[line_start:line_end]]

    # line offset
    offset = -4

    for i, line in enumerate(lines, 1):
        if insert_after in line:
            print("FOUND INSERT LINE")
            lines.insert(i+offset, insert_code)
            break
    else:
        append_menu()
        return

    # import bpy - hacky!
    lines.insert(1, '    import bpy\n    from bpy.app.translations import contexts as i18n_contexts\n')

    # Debug output
    #f = open("/home/poor/Desktop/c.txt", "w").writelines(lines)
    l = {}

    exec("".join(lines), {}, l)

    #bpy_type_class.draw.__code__ = code_object # Doesn't work, since a single func is not a module
    DrawFuncStore.bpy_type_class.draw = l['draw'] # exec defined our custom draw() func!

def append_menu():
    bpy.types.VIEW3D_PT_view3d_meshdisplay.prepend(draw_item)

def remove_menu():
    if DrawFuncStore.draw is not None:
        DrawFuncStore.bpy_type_class.draw = DrawFuncStore.draw
        DrawFuncStore.draw = None

    else:
        bpy.types.VIEW3D_PT_view3d_meshdisplay.remove(draw_item)


def register():
    insert_menu()

def unregister():
    remove_menu()

if __name__ == "__main__":
    register()


Note as @CoDEmanX mentioned:


  This method only works as long as there's just one addon replacing the code object of a certain bpy type.