IPython: load extension automatically upon start
Question: In IPython, I can load a custom extension using simple command:

    
    
    %load_ext physics
    

This will load the file `~/.config/ipython/extensions/physics.py`.

How can I tell IPython to load the extension automatically on startup?

I have added the line to `/.config/ipython/profile_default/startup/import.py`,
but that does not work:

    
    
    from numpy import *
    
    %load_ext physics
    

When I start IPython, I get folowing error:

    
    
    File "~.config/ipython/profile_default/startup/import.py", line 17
    %load_ext physics
    ^
    SyntaxError: invalid syntax
    


Answer: From the IPython documentation:

**Using extensions**

To load an extension while IPython is running, use the %load_ext magic:

    
    
    In [1]: %load_ext myextension
    

To load it each time IPython starts, list it in your configuration file:

    
    
    c.InteractiveShellApp.extensions = [
         'myextension'
    ]`
    

Hope that helps

