Python Forum
start interactive pyhton shell with pre-loaded custom modules
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
start interactive pyhton shell with pre-loaded custom modules
#1
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.
Error:
TypeError: 'module' object is not callable
Thanks for any help
Reply
#2
Show us your modules, because it's working.

a.py

def a():
    print("hello")
main.py

import a
import code

>>> a.a()
hello
Reply
#3
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/...".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Package cannot be loaded into PBS queue file emersonpl 1 357 Sep-09-2021, 08:06 PM
Last Post: emersonpl
  PyQt5 MySQL Drivers Not Loaded AdeS 7 958 Aug-06-2021, 08:34 AM
Last Post: AdeS
  Reading Multiple text Files in pyhton Fatim 1 581 Jun-25-2021, 01:37 PM
Last Post: deanhystad
  MacOS BigSur Python3 - dyld: Library not loaded: trillionanswers 1 2,525 Mar-02-2021, 11:00 PM
Last Post: nilamo
  Why is mpl_toolkits loaded? Gribouillis 1 596 Jan-30-2021, 08:39 PM
Last Post: Serafim
  interactive map and function hurc60248 1 711 Jan-08-2021, 09:22 PM
Last Post: Larz60+
  Pyhton code help from head first with python Shaikat_99 3 1,208 Jun-07-2020, 09:12 AM
Last Post: snippsat
  PYHTON not opening files profficial 11 8,994 Feb-15-2020, 09:06 AM
Last Post: bharathendra
  Basic Pyhton for Rhino 6 question about variables SaeedSH 1 959 Jan-28-2020, 04:33 AM
Last Post: Larz60+
  Pyhton Coding Help Needed (very small error) friduk 2 1,172 Oct-23-2019, 08:41 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020