In Bash, I assume that you define these aliases in a .profile , .bash_rc or similar file. In this file add the line
export PYTHONSTARTUP=~/.python_rc.py
This will allow you to create a .python_rc.py file that will be included each time the session starts at the Python / REPL prompt. (It will not be included when running Python scripts, because it can be destructive for this).
Inside this file, you can define a function for the command that you want to save. In your case, what you are doing is actually more complicated than it sounds, so you will need to use a few more lines:
def profile(): global Profile import sys if "path/to/your/project" not in sys.path: sys.path.append("path/to/your/project") from userprofile.models import Profile
After that, you can call profile() to import the Profile at the Python prompt.
source share