Python 是否可以从其他模块访问全局函数?

Python 是否可以从其他模块访问全局函数?,python,Python,我正在扩展一个现有模块,该模块定义了一个我想要使用的函数 import os import sublime import sublime_plugin git_root_cache = {} def open_url(url): sublime.active_window().run_command('open_url', {"url": url}) 从同一个插件中,我成功导入并运行类内运行的函数: class PanagoraBuildCommand(GitWindowComm

我正在扩展一个现有模块,该模块定义了一个我想要使用的函数

import os
import sublime
import sublime_plugin


git_root_cache = {}

def open_url(url):
    sublime.active_window().run_command('open_url', {"url": url})
从同一个插件中,我成功导入并运行类内运行的函数:

class PanagoraBuildCommand(GitWindowCommand, sublime_plugin.TextCommand, sublime_plugin.WindowCommand):
    def run(self, edit):
        #Get the git-folder-name
        workingDir = self.get_working_dir()

如何从类中的依赖模块运行函数。我无法更改现有模块。

如果我理解正确,您希望从PanagraBuildCommand类调用作为git模块一部分的open_url()方法,那么您必须:

from git import open_url
然后,在PanagraBuildCommand类中,您只需调用:

open_url(<<value for url parameter>>)
open_url()

当然有可能,但从描述来看,我并不理解任何事情。你想调用什么函数?