Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Calling function within other files and order of loading..

    Scheduled Pinned Locked Moved Discussion
    bluetooth
    3 Posts 2 Posters 818 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      misterlisty
      last edited by

      I have created different py files for different functions eg bluetooth.py wifi.py etc

      When boot.py and main.py load...do the other files get loaded if not when do they get loaded? From boot.py i'm trying to load a function within bluetooth.py but i get error NameError: name '_bluetooth_scan' is not defined

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @misterlisty
        last edited by

        @misterlisty Modules are loaded with the "import name_of_module" statement. After that, functions and classes arfe added to the namespace and can be used. You can issue the import statement at the REPL prompt interactively, of in your main script and use it then.
        This is the typical Python behaviour. I recommend getting lessons or reading a suitable book on Python.

        1 Reply Last reply Reply Quote 0
        • M Offline
          misterlisty
          last edited by

          thanks, i'm reading the python resource online

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom