I want to bring up a python window (could be idle or cmd based) with some packages already imported by double clicking a python script. Is this possible? If so, how do I do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure. You want something like this:
When you put the above code in a file and run it, you’ll see a traditional Python REPL (interactive interpreter), except the
sysmodule will already be loaded. You can add more modules to your REPL by importing them into your script and adding them to thepreloaded_modulesdictionary.The code module also has tools to build all kinds of custom interpreters.
More info here: Python code module
(NOTE: the above refs Python 2.x, but it should be mostly the same in 3.x)