omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Issues with multiple files and detecting changes

    Pythonista
    2
    3
    2354
    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.
    • Gibberish
      Gibberish last edited by

      I've created some classes in a file (let's call this file Abc) and want to call it from another file (let's call this one Def). After my import of Abc into file Def, I can instantiate the class in file Abc.

      However, once I start making changes to the class in Abc, my changes don't get reflected when I run Def until I kill Pythonista and restart. If I do the name == main check in Abc, I can run a simple test within Abc and see my changes - but even after this if I rerun Def, my changes are not reflected (until the restart). It's almost as if the Abc file is cached in memory.

      I am using ios 8.2 with Pythonista 1.5 on an Air 2.

      Any thoughts?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        When you import in Python, the imported module is indeed cached. You can use reload on the imported module, e.g

        import abc
        reload (abc)
        

        Alternatively, you could use this in the action menu to reload all custom modules in one shot.

        1 Reply Last reply Reply Quote 0
        • Gibberish
          Gibberish last edited by

          Thanks! That helps!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors