Forums

How to import module to python console

I'm new to programming, so this is a basic question. I have a module name fibo.py save in /home/beerclaw/fibo.py directory I want to import this to a python 3.4 console How do i do that?

Hi there,

What tutorial are you using to learn Python? It should cover imports at some point.

Try "import fibo" or "from fibo import my_thing"...

I hope you enjoy learning Python every bit as much as I did!

The way I'd do that is to run a bash console in the /home/beerclaw folder and then run:

python3.4 -i fibo

That will load fibo and then leave you in an interactive console.

Dave.