If you’ve used Ruby on Rails, I’m thinking of the feature where the user types
‘rails console’
and instantly gets a Ruby console with rails and the current app already loaded.
I want to make something like this for a python program I’m working on, does anyone know how I would get to type say,
‘python myPythonConsole.py’
and open up a regular python interpreter but with my program and all its dependencies loaded?
If I understand you correctly then you might want
python -i myPythonConsole.py. It gives you a console when the script has finished so you have to run your application in a different thread.To create a console in a script you would use the code module.