start interactive pyhton shell with pre-loaded custom modules - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: start interactive pyhton shell with pre-loaded custom modules (/thread-25709.html) |
start interactive pyhton shell with pre-loaded custom modules - Viktor - Apr-09-2020 Hi all, I'm a beginner & giving myself a few simple projects to try to find stuff out. I'm trying to make a sort of desktop calculator in the form of a interactive python shell with some modules already loaded so i can just press a shortcut and go. OS: kubuntu 18.04 python 3.6.9 #!/usr/bin/env python3 # import some modules import math import compound_interest import check_prime # Go to interactive mode import code #code.interact(local=locals())the build-in module math works, but the self-mades ones don't (see error below). also, i'd like to suppress the version information that's printed when switching to interactive. Thanks for any help
RE: start interactive pyhton shell with pre-loaded custom modules - Mateusz - Apr-09-2020 Show us your modules, because it's working. a.py def a(): print("hello") main.py import a import code >>> a.a() hello RE: start interactive pyhton shell with pre-loaded custom modules - Viktor - Apr-09-2020 Thank you for replying. It was indeed in the modules. I wrote them first as little programs and didn't realise i needed to remove the "#!/usr/bin/...". |