Using Libraries with python3

Spread the love




Clone the Github code

Clone the repositories from Github to your robot.


sudo git clone

Possible Errors: fatal: destination path ‘IntroToPython3Libraries’ already exists and is not an empty directory.

Solution: If the directory already exists and you want to remove it, enter the following to delete ALL files in the IntroToPython3Libraries and the parent folder.

sudo rm -rf IntroToPython3Libraries

Change to the directory and change the file permissions so you can read/write/execute.

cd IntroToPython3Libraries

sudo chmod 777

sudo chmod 777 <file/folder>


Open the program called ‘ from the ‘subfolder’ directory’. This will be the library we call.


This library can run on it’s own and has it’s own demo.

Now Call it from another program.

Open the program called ‘’ and import ‘’


Please note the lines which are “commented” (Lines 6-7 and 49-50).

See the difference between importing and from-importing?

Also notice, the demo() from the library didn’t execute? This is because ‘’ uses the “if name == __main__” function.

Any ‘imports’ required in the imported libraries will be done automatically within the imported programs. There is no need to re-import them in the main program.

Did it work?

If you had an issue or suggestion, please report it on the our github page.

Can you help make this better?

Do you have an idea to make this project better? Please leave a comment below…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.