Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Using the Project Anywhere

In this lesson, you’ll experiment with calling snakesay in different ways:

  • With -m
  • Without -m
  • From the REPL

00:00 Now, that means that we can basically call it any way we like and from anywhere. Yeah, let’s try it. So now, we remember that we had issues where we couldn’t do both python -m snakesay and python snakesay. Now we should be able to do both.

00:16 So now we can just do snakesay Sleep tight, little man-cub. Cool, that’s working. And that was the one that wasn’t working before, because in the code we were saying from snakesay import snake.

00:33 That broke that way. This meant that we needed to use the -m flag. Exactly. But now it’s working. And I assume that the -m flag will also work.

00:45 Great. It does. And this is even cooler now because now you can even go out of this project. Wow. And you can now run your -m version …

01:09 and it runs from here as well. Okay, great. So if we go into pythonYes, so now you can even import snakesay, and we even now run the from snakesay import snake.

01:27 Yeah, exactly, and run our snake.say() command here.

01:41 Great. So this gives us a load of flexibility. Yeah, it gives you all the conveniences of installed packages because that’s exactly what we’ve done. And now there’s no reason to ever think about the path again. Right.

01:54 And also, it prevents us from having to think about relative imports as well because even if we’re in a very deep subfolder of our package, we can still just say from snakesay import snake. Yep, so the imports are all consistent all the time.

02:10 You can just always start at snakesay and find whatever you’re looking for.

Become a Member to join the conversation.