Skip to content
Back to posts

Automatically Import Modules When IPython Starts

A simple IPython startup-script setup that makes frequently used modules available in every interactive session.

Create a script under ~/.ipython/profile_default/startup/. The filename is up to you; for example, start.py. Import frequently used packages in that script, and IPython will load them every time it starts instead of making you import them manually when needed.

import os
import sys
import time
import json
import requests
import logging
import base64
from datetime import datetime, date
from pprint import pprint as pp

There are several other useful IPython features. I will summarize those another time—I’ve been a little too lazy lately.


Originally published on SegmentFault.

Copyright notice

Unless otherwise stated, quietin owns the copyright in all articles. All rights reserved. Except as permitted by law or with prior written permission, reproduction or republication, in whole or in part, is prohibited. Permitted quotations must credit the author and link to the original article.